Hi, Just posting a sample code for creating appointment record in CRM 2011.Uri organizationUri = new Uri(<a href="http://CRM2011/orgName/XRMServices/2011/Organization.svc">http://CRM2011/orgName/XRMServices/2011/Organization.svc</a>); Uri homeRealmUri = null; ClientCredentials credentials = new ClientCredentials(); credentials.Windows.ClientCredential = new System.Net.NetworkCredential("administrator", "password", "contoso"); OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null); // Get the IOrganizationService IOrganizationService orgService = (IOrganizationService)orgProxy; // create entity record Entity appointment = new Entity(); appointment.LogicalName = "appointment"; appointment.Attributes["subject"] = "App at " + DateTime.Now.ToString(); appointment.Attributes["scheduledstart"] = new DateTime(); appointment.Attributes["scheduledstart"] = DateTime.Now.AddDays(1); appointment.Attributes["scheduledend"] = new DateTime(); appointment.Attributes["scheduledend"] = DateTime.Now.AddDays(1).AddHours(2); // create activity party record Entity activityParty = new Entity(); activityParty.LogicalName = "activityparty"; activityParty.Attributes["partyid"]=new EntityReference("systemuser",new Guid("userGuid")); EntityCollection colAP = new EntityCollection(); colAP.Entities.Add(activityParty); appointment.Attributes["organizer"] = new EntityCollection(); appointment.Attributes["organizer"] = colAP; // If we use the bookrequest class it will fail // and gives ResourceBusy error in case of scheduling conflict // so simply create the appointment without using book request // to make it appear in the calendar // BookRequest bookRequest = new BookRequest(); // bookRequest.Target = appointment; try { // BookResponse booked = (BookResponse)orgService.Execute(bookRequest); string appGuid = orgService.Create(appointment).ToString(); } catch (Exception ex) { string exMessage = ex.Message; }Hope it helps !
“DropDownList has a SelectedIndex which is invalid because it does not exist in the list of items” error while setting SelectedIndex
I had my drop down list defined as following
<asp:DropDownList
ID=”ddlNeedEFMP” runat=”server” Enabled=”False”>
<asp:ListItem
Value=”2″>No</asp:ListItem>
<asp:ListItem
Value=”1″>Yes</asp:ListItem>
</asp:DropDownList>
To set it’s selectedindex we can make use of below syntax.
ddlNeedEFMP.SelectedIndex= ddlNeedEFMP.Items.IndexOf(ddlNeedEFMP.Items.FindByValue(“1”));
Hope it helps.
Some useful links while working with CSS.
Has some simple css for tables à
http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs/
Good site with live examples à
http://icant.co.uk/csstablegallery/tables/47.php
Setting CSS for disabled textbox à
http://www.cssportal.com/form-elements/text-box.htm
Bye.
Exception message “entityName” in CRM 2011
Hi,
We get the “entityName” exception if we haven’t specified value for LogicalName property of Entity class. (easy to figure out 🙂 )
Hope it helps!
Using Bulk Data Export tool of CRM 4.0 with CRM 2011
We need to make following changes to get the Bulk Data Export tool for CRM 4.0(http://mscrmbulkdataexport.codeplex.com/workitem/list/basic) to work with CRM 2011.
Change the app.config of the tool
http://mscrmuk.blogspot.com/2011/02/using-crm-40-assemblies-on-crm-2011.html
<runtime>
<assemblyBinding
xmlns=“urn:schemas-microsoft-com:asm.v1“><dependentAssembly>
<assemblyIdentity
name=“Microsoft.Crm.Sdk“
publicKeyToken=“31bf3856ad364e35“
culture=“neutral“/>
<publisherPolicy
apply=“no“/>
</dependentAssembly>
</assemblyBinding>
</runtime>
And add references to the 64 bit version of Microsoft.crm.sdk and Microsoft.crm.sdktypeproxy dlls. (Which we can get from its SDK)
http://www.box.net/shared/z6z1dcby0k
Hope it helps.
Configuring Forms Based Authentication (FBA) for SharePoint 2010
Create a new web application from Central Administration.
Select Authentication as Claims Based Authentication

Check Enable FBA checkbox and specify Membership provider name and role manager name as SqlMembers and SqlRoles.

Click on Ok to create the web application.
After successful creation of the web application create a site collection.
Navigate to C:\Windows\Microsoft.NET\Framework64\v2.0.50727 and run aspnew_regsql.exe tool there.
Follow the screen shots below to create a new database named MYFBADB.



After successful creation of the database add the following information(highlighted in yellow) to the web.config file of our FBA application
<membership
defaultProvider=“i“>
<providers>
<add
name=“i“
type=“Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c“ />
<add
connectionStringName=“SqlConn“
applicationName=“/“
name=“SqlMembers“
type=“System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a“
minRequiredPasswordLength=“5“
minRequiredNonalphanumericCharacters=“0“ />
</providers>
</membership>
<roleManager
defaultProvider=“c“
enabled=“true“
cacheRolesInCookie=“false“>
<providers>
<add
name=“c“
type=“Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c“ />
<add
connectionStringName=“SqlConn“
applicationName=“/“
name=“SqlRoles“
type=“System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a“ />
</providers>
</roleManager>
</SharePoint>
<connectionStrings>
<add
name=“SqlConn“
connectionString=“server=crm2011;database=MYFBADB;Trusted_Connection=true“ />
</connectionStrings>
<system.web>
Next open the web.config of the Central admin site and add the same information added above
<roleManager
enabled=“true“
defaultProvider=“AspNetWindowsTokenRoleProvider“>
<providers>
<add
connectionStringName=“SqlConn”
applicationName=“/”
name=“SqlRoles”
type=“System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a“/>
</providers>
</roleManager>
<providers>
<add
connectionStringName=“SqlConn”
applicationName=“/”
name=“SqlMembers”
type=“System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a“ />
</providers> </membership>
</SharePoint>
<connectionStrings>
<add
name=“SqlConn“
connectionString=“server=crm2011;database= MYFBADB;Trusted_Connection=true“ />
</connectionStrings>
<system.web>
Lastly add the following configuration information in the web.config file of the SecurityTokenServiceApplication (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken)
</system.net>
<connectionStrings>
<add
name=“SqlConn“
connectionString=“server=crm2011;database= MYFBADB;Trusted_Connection=true“ />
</connectionStrings> <system.web>
<membership
defaultProvider=“SqlMembers“>
<providers>
<add
connectionStringName=“SqlConn“
applicationName=“/“
name=“SqlMembers“
type=“System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a“ />
</providers>
</membership>
<roleManager
enabled=“true“
defaultProvider=“SqlRoles“>
<providers>
<add
connectionStringName=“SqlConn“
applicationName=“/“
name=“SqlRoles“
type=“System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a“/>
</providers>
</roleManager>
</system.web>

That’s it.
