Archive for February, 2010

Fri, Feb 5th, 2010
posted by Nicholas Cole 04:02 PM

Looking at the problems with file storage and CRM i yet again find myself looking for a better way to manage files and file storage through the wonderful CRM Interface. The main premise again sticking to the slogan of everything all in one place.

For this situation we have seperate network fileservers that handle our data storage on the network, and it wouldn’t make sense putting all that information into the CRM Database. Not to mention it isn’t indexable or searchable, so the value add for that would be really low.

The problem that i have ran into is that i do not want to have to change coding that i had previously from another post when my clients switch from Sharepoint Services and full sharepoint server in their Microsoft CRM implmenetations. So i have devised a different way to handle this that will also assist with future CRM 4 (IFD) and offsite Sharepoint Installations.

I first created a custom attribute in Microsoft CRM named SPFOLDER, and placed it on the company tab in Microsoft CRM. This was a simple bit flag that i will use for a CRMworkflow to determine if folders have already been created on our sharepoint server or not for a particular company.

For displaying on the company form you can add a simple check to see if the bit flag is set to yes or no. If it is set to true, then show the folder on the server through a simple iframe in CRM, named SPFiles. (as in the example below)

if (crmForm.all.sti_spfolder.DataValue == true)
{
crmForm.all.IFRAME_SPFiles.src = “http://fileserver/Client%20Data/Forms/AllItems.aspx?RootFolder=%2fClient%20Data%2f” + crmForm.all.accountnumber.DataValue;
}

if (crmForm.all.sti_spfolder.DataValue == false)
{
crmForm.all.IFRAME_SPFiles.src = “http://crmserver1/SPIntegration/default.aspx?accid=” + crmForm.all.accountnumber.DataValue;
}

I have structured the folder storage by account number because we have multiple names for some companies that are similar so i found account numbers work best, but you could adjust for whatever makes sense in your organization. In this example we use Dynamics GP inhouse and it is connected with CRM so the information is populated automagically!!!

So now that we have a simple way to handle how to display the sharepoint data, we simply need to have an event to create the folder structure.

Using a simple http webrequest we can generate these folders into Sharepoint from the data we have, and this will allow us to display the customers specific data folders as well.

 

HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(”http://fileserver/Client%20Data/” + lbl_CustomerName.Text + “”);

request.PreAuthenticate = true;
CredentialCache credentials = new CredentialCache();

NetworkCredential netCredentials = new NetworkCredential(”sharepoint”, “Pass@word1″, “MEDTECH”);

request.Credentials = netCredentials;

//Send Request

request.Method = “MKCOL”;

HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();

response.Close();

 

 

 

 This will allow you to create company specific storage areas in Microsoft CRM. I have included some pictures as well to display how this looks in CRM on my machine.