Another CRM -> Sharepoint integration


Here is my first blogpost in English since I received requests from non speaking
Swedes. The MSCRM team, Kjell-Sverre Jerijærvi
(Integrating
team-sites into MSCRM (part II)
) and allot of others has published different
ways of integrating MSCRM with Sharepoint. Guess what! Here is another solution
actually made back in 05’ as a Proof of concept solution… Each Account has its own
sharepoint library structured under an alphabetic label (dummy library). This is
done initial on setup of libraries A,B,C,D etc. A custom Sharepoint template is
used for MSCRM look and feel (not in scope of this blogpost)

For example Alfa Demo Account is stored as own library under letter A with it’s
url stored on the MSCRM.


SPSite site = null;

try


{


          
site = new SPSite(wssServerUrl);


          



          
SPSite newSite = site.SelfServiceCreateSite(rootUrl, siteName,


                     
description, 1053, “STS”, @”custom\mscrm”, “Admin”,


                     
“mscrm@custom.local”, @”custom\mscrm”, “Admin”, “mscrm@custom.local”);


          



          
SPWeb web = newSite.OpenWeb();


          
web.Webs.Add(nextLevelSiteName, nextLevelSiteName, description, language,
template, false, false); style='mso-tab-count: 5'>                                                   



}

catch (SPException err)


{


          
System.Diagnostics.Debug.WriteLine(err.Message);


          
throw;


}


 

catch (Exception err)


{


          
System.Diagnostics.Debug.WriteLine(err.Message);


          
throw;


}

finally


{


          
site.Dispose();


}


 


 


A new chrome remover file is stored under its own web.



MSCRM_iframe.aspx cleaner removes chromes
from library files


 

<%@ Page Language=”C#” %>

<%string sUrl = Context.Request[“url”]; style='background: yellow; mso-highlight: yellow'>%>

<!DOCTYPE lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">HTML style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">PUBLIC lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">“-//W3C//DTD HTML 4.0 Transitional//EN”>

<html style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">>

<head style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">>

<title style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">> lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; mso-ansi-language: EN-US">MSCRM
Integration</title style='color: blue'>>

<script style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">language=”Jscript”>

var iNavCount=0;var strValidPages=”AllItems.aspx,Upload.aspx,Checkin.aspx,EditForm.aspx,DispForm.aspx,Versions.aspx,SubNew.aspx”; style='color: blue'>var strOriginalUrl=”<%=sUrl%>”;function
evReadyStateChange()


{var oFrm=document.frames.mscrmShowPage;var
ofrmElement=event.srcElement;try{ style='color: blue'>var
sDoc=oFrm.location.pathname;sDoc=sDoc.substring(sDoc.lastIndexOf(“/”)+1); style='color: blue'>if(ofrmElement.readyState==’loading’){ofrmElement.style.display=”none”;oFrm.onerror= style='color: blue'>function(){return
true;}}else style='color: blue'>if(ofrmElement.readyState==’complete’){var
bValid=false;iNavCount++;var
arrTmp=strValidPages.split(“,”);for(var
s in arrTmp)if(arrTmp[s]==sDoc)bValid= style='color: blue'>true;if(!bValid){document.location.assign(“MSCRM_error.aspx?rUrl=”+location.href);} style='color: blue'>else{try{var
oTable=oFrm.document.all.tags(“table”)[0];oTable.rows(0).style.display=”none”;oTable.rows(1).style.display=”none”;oTable.rows(2).cells(0).style.display=”none”;oFrm.document.all(“diidEditInGridButton”)[0].parentNode.parentNode.style.display=”none”;oFrm.IMNShowOOUI= style='color: blue'>function(){return
false;};}catch(e){}


oFrm.document.body.insertAdjacentHTML(“beforeEnd”,”<a href=’#’ onclick=’window.open(location.href)’
class=’ms-formdescription’ style=’position:absolute;top:10px;right:10px;color:blue’>In
new window</a>”);ofrmElement.style.display=”inline”;}}}

catch(e)


{}}

</script lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">>


  </
head >


  <
body style='color: red'>style
=”margin:0 0 0 0″>
 

<%if (sUrl!=null) {%>


          
<iframe style='color: fuchsia'>
id=”mscrmShowPage” style='color: fuchsia'>frameborder=”0″ style='color: fuchsia'>height=”100%” style='color: fuchsia'>width=”100%” style='color: fuchsia'>onreadystatechange style='color: blue'>=”evReadyStateChange()” style='color: red'>style=”display:none” style='color: fuchsia'>src=” style='background: yellow; mso-highlight: yellow'><%=sUrl%>“></ style='color: maroon'>iframe>

<%}%>


  </
body >

</html lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">>


 

On MSCRM server a new virtual directory
(or new web according to ISV rules) holds files to link it all to WSS or Sharepoint
side.


<div style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">class=”tab” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">id style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”tabBody1″ lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">style style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”DISPLAY:
inline”>


<table style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">id=”Table0″ style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">style=”TABLE-LAYOUT:
fixed”
height style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”100%” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">cellSpacing style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”0″ lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">cellPadding style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”3″ lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">width style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”100%”>


<tr style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">>


<td style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">>


<iframe style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">id=”Iframe0″ style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">frameborder=”0″ lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">width style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”100%” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">height style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”100%” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">src style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=” lang="EN-US" style="font-size: 10pt; background: yellow; font-family: 'Courier New';
mso-ansi-language: EN-US; mso-highlight: yellow"><%Response.Write(ConfigurationSettings.AppSettings[“PathToMSCRM”].ToString()); style='background: yellow; mso-highlight: yellow'>%>/SharePointConnector/_redirect.aspx? style='background: yellow; mso-highlight: yellow'><%Response.Write(Request.QueryString); style='background: yellow; mso-highlight: yellow'>%>&Folder=1″></ style='color: maroon'>iframe>


</td lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">>


</tr lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">>


</table lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">>


</div lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">>

Clip from AccountCreateFrame.aspx .


I added 2 keys in MSCRM’s web.config
for dynamic settings

<appSettings style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">>

<add style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">key=”PathToMSCRM” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">value style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”http://crm/Beta.Crm.Sharepoint/” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">/>

<add style="font-size: 10pt; color: fuchsia; font-family: 'Courier New'; mso-ansi-language: EN-US"> lang="EN-US" style="font-size: 10pt; color: red; font-family: 'Courier New';
mso-ansi-language: EN-US">key=”SharePointServerIframe” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">value style="font-size: 10pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US">=”http://sharepoint/_layouts/CRM/MSCRM_iframe.aspx?url=” lang="EN-US" style="font-size: 10pt; color: fuchsia; font-family: 'Courier New';
mso-ansi-language: EN-US">/>

</appSettings lang="EN-US" style="font-size: 10pt; color: blue; font-family: 'Courier New';
mso-ansi-language: EN-US">>


 


I prefer to add everything on the leftside navigation
and that could be easily done by modification of ISV.config 
or by injecting js script in from onLoad





Documents added in
ISV.config pointing <PathToMSCRM> Accountcreateframe.aspx


 

You can download all files here
and hopefully everything is clearer when you look at the code
style='font-family: Wingdings; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri;
mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin;
mso-char-type: symbol; mso-symbol-font-family: Wingdings'>J


NOTE!!! You are required to
have licenses for SharePoint server

Not Supported example code.zip

Comments (4)

  1. prasadrn says:

    I have a HTTP handler as shown below. It works for one user (that’s me), but not for other users on the fareast.corp.microsoft.com domain. I am on the same domain. What the problem could be?

    public class SyncHandler : IHttpHandler

       {

           byte[] fileBytes = new byte[256];

           public bool IsReusable

           {

               get { return false; }

           }

           public void ProcessRequest(HttpContext context)

           {

               context.Request.SaveAs(@"c:\request.txt", true);

               context.Response.Write("From main handler ");

           }

       }

    COuld it be that the handler dll, in which this class is defined, doesn’t allow other users to access "c:"? Please advise. I couldn’t find another place for this query. My apologies for any inconvenience.

    I am using handler to process POST requests for a SP site. So I have set WSS trust settings properly.

  2. Buy valium. says:

    Drug valium. Buy valium. Valium. Valium causing depression. Valium liquid form.