Get Value for Person or Group Column Type


To get the value for Person or Group Column Type after removing the special characters from it, use this function

private string  GetValue(SPListItem item, SPField gpField)
{
    string currentValue = item[gpField.Title].ToString();
    SPFieldLookup field = (SPFieldLookup)gpField;
    SPFieldLookupValue fieldValue = (SPFieldLookupValue)field.GetFieldValue(currentValue);
    return fieldValue.LookupValue;
}

to call it

string strName = GetValue(spListItem, spListItem.Fields["fieldName"]);

 

Bye..

A nice tool for working for CRM


Hi,

Check out this wonderful tool

CRM Configuration Manager

 

Bye..

Pre-generated XmlSerializers (CrmService)for Plugin


Please refer this article

http://uwekaessner.spaces.live.com/blog/cns!21916E8556D908E!175.entry?sa=260352433

I am just writing out the main steps from it and the steps where we need to strong sign the assembly so that it could be used within Plugin.

Add web reference to CrmService.asmx

http://servername/mscrmservices/2007/CrmService.asmx

Go to “web references” folder.

Copy Reference.cs file to a new folder.

Rename it to CrmServiceSerialized.cs

Open the CrmServiceSerialized.cs class, rename the class to CrmServiceSerialized.

namespace MyApplication.CrmServiceSerialized

Change the CrmService property

public CrmService(string url) {

           this.Url = url;

Complie it to a dll

If we want to use the Serialized dll within Plugin we need to strong sign it

sn.exe -k g.snk

csc /t:library /out:CrmServiceSerialized.dll CrmServiceSerialized.cs /keyfile:g.snk

To pre generate a strong named XmlSerializer dll

sgen.exe /p CrmServiceSerialized.dll /compiler:/keyfile:g.snk

Next again open CrmServiceSerialized.cs and comment out all occurrences of [System.Xml.Serialization.XmlIncludeAttribute using Find and replace.

Next we need to add the attribute

“[System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = "CrmServiceSerialized.XmlSerializers")]”

to the “CrmServiceSerialized” class.

Again generate the strong name assembly using the same key

csc /t:library /out:CrmServiceSerialized.dll CrmServiceSerialized.cs /keyfile:g.snk

Now we can add reference to CrmServiceSerialized.dll in our plugin to use it. Here also need to place CrmServiceSerialized.dll  and CrmServiceSerialized.XmlSerializers.dll to the GAC.

Check this link as well

http://blogs.javista.com/2009/03/18/best-practices-for-crm-memory-usage/

Bye..

Sign an already built assembly


Hi,

These are the steps to be followed to sign an already built assembly

Open Visual Studio Command prompt.

Generate a KeyFile:

sn -k keyPair.snk

Obtain the MSIL for the provided assembly:

ildasm myAssembly.dll /out:myAssembly.il

Rename/move the original assembly

Create a new assembly from the MSIL output and your assembly

ilasm myAssembly.il /dll /key= keyPair.snk

Bye..

Converting html to text for email in CRM


Hi,

Please check out these links

C# code

http://aliraza.wordpress.com/2007/07/05/how-to-remove-html-tags-from-string-in-c/

JavaScript code

http://mscrm4ever.blogspot.com/2008/08/stripping-html-tags-from-email.html

A sample plugin

http://blogs.msdn.com/ukcrm/archive/2008/07/10/converting-html-e-mail-to-plain-text.aspx

Bye..

Pre-generated XmlSerializers for CrmService


Hi,

While looking for a way to boost performance while using CrmService, these are the two good articles that i found.

http://blogs.msdn.com/crm/archive/2009/02/02/boost-performance-with-pre-generated-xmlserializers.aspx

http://uwekaessner.spaces.live.com/blog/cns!21916E8556D908E!175.entry?sa=202741036

Bye..