I have a requirement to display a SharePoint 2010 document library in an IFrame which will be hosted in a MS Dynamics CRM 4 entity form.

Through the IFrame to the document library, I want to be able to add new and upload existing documents. These documents need to be tagged in SharePoint 2010 with certain CRM entity attributes.

It is proposed these tags will be passed to SharePoint via the IFrame url i.e. ID1=123&ID2=456 etc.

I'm thinking an application page to capture the parameters and an event receiver to tag the documents.

I'm able to extract the parameters from the URL in the app page and add them to a helper class but I can't think how I can join this up with the event receiver - the event receiver can't get access to the existing instance of the helper class and using a static wont support more than 1 update at a time.

The other option that comes to mind is to code all of the required New document and upload functionality and thereby have the paramrters to hand. I think I'd need to throw up a dialog when a document was being created / uploaded that the user would need to close so that I can update the metadata.

I'm open to other solutions .....

  • I can't exactly understand what you want, but I can filter out that you want to add CRM metadata to the document(s) that you are uploading to sharepoint. My guess is, that you iframe an Url like sharepointserver.corp/anypage.aspx?ID1=123&ID2=456. how do you want to use the helper class? to check the metadata or what? Or to convert some metadata to "standard" tags? Is it an option to synchronize your ECM metadata with the managed metadata taxonomy service?
    – Bas Lijten
    Jul 10, 2011 at 17:02
  • We are trying to do exactly the same thing - store documents in Sharepoint, but have them linked to CRM entities and almost all the interface for adding these documents is exposed through CRM one way or another. Interested to see what sort of answers come up in this.
    – dunxd
    Jul 18, 2011 at 16:09

2 Answers 2


@Robert, I tried the constructor idea and found that this:

I use this url to get to a document library (note the parameter wortony=1):


When I use the New document process from SharePoint the constructor fires and the HttpContext is NOT available for either the ItemAdding or ItemAdded events.

This means there is no way to get at the parameters from the url.

When I use the upload a document process from SharePoint the constructor fires and the HttpContext IS available, however, the current.Request.Url.AbsoluteUri is set to this


As you can see the result is that the url no longer resembles the url and the point is that the wortony=1 is missing from the url.

In the end I went for an additionalpagehead delegate control which is included on every site page (via the masterpage).

The control can get at and parse the query string and pops the params into the HttpRuntimeCache under the users login id.

The event receiver then pops the params out via the ListItem["Created By"] property and sets them accordingly.

This seems to be a solution.


In the constructor of your event handler, you can parse your query string parameters and store their values them in an instance variable. Then you can access these values on your ItemUpdating or ItemAdding-Methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.