web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

SharePoint Document Library in an IFrame

(0) ShareShare
ReportReport
Posted on by 230

Hello All,

I've been asked to make a workflow for CRM 4.0 that creates a document library for the customer, when a certain condition on the customer form is met, and then return the URL to the document library to CRM and set the URL of the IFrame to this value  (like so http://blogs.msdn.com/crm/archive/2008/03/28/contextual-sharepoint-document-libraries-and-folders-with-microsoft-dynamics-crm.aspx).

This all works fine and dandy, but I need the document library returned without the chrome of the top and left navigation areas. I've tried making a view and editing it in a SharePoint Designer, but I don't really want to do that with 3k+ sites, now do I? So, if any of you have any hints or tips, I'd love to hear them. Or, at least can point me in the right direction as to where to read about people who've done just this, I'd much appriciate it.

 Kind Regards,

Martin

*This post is locked for comments

I have the same question (0)
  • Sergio Mocha Profile Picture
    on at
    Re: SharePoint Document Library in an IFrame

    Hello Martin, Have you got any solution for this subject?

    THanks

  • Martin Ladefoged Profile Picture
    230 on at
    Re: Re: SharePoint Document Library in an IFrame

    Hi there,

    I found a work around for this by simply using a sitetemplate (.stp), I had edited in the SharePoint designer and stripped down to only showing a bare minimum of controls (style="display:none;" tags all over the place). AFter that, I created sites with this template and added a document library from a template as well (with the columns, sorts etc requested), and then adding the link in CRM workflow.

    Hope this helps you, mate. If you need anyhting clarified, just hollar.

     

    /Martin

  • Sergio Mocha Profile Picture
    on at
    Re: Re: Re: SharePoint Document Library in an IFrame

    Hello Martin, thanks by your early answer.
    Howerver I'm writing you again because I had not got to open sitetemplate... I have saved my site as site template (I must include content or not?) Later I have installed Sharepoint Designer 2007 and I have tried to open my site template with Sharepoint Designer as your instructions, but it seems to be non permitted file.

    Do you have any suggestion?

    Thanks in advance,

    Sergio

  • Martin Ladefoged Profile Picture
    230 on at
    Re: Re: Re: Re: SharePoint Document Library in an IFrame

    Hey Sergio,

    As far as I can see, you're doing it a bit wrong. Firstly, you need to edit the page, you want to use as a template, before saving it, as (as far as I understand) sitetemplates can only be edited programmatically, and I don't even want to go there! So, try this instead:

    - Create a teamsite or whatever, and add the document libraryy webpart to the page.

     * Open the site in SharePointDesigner 2k7. Trim all the chrome and whatnot away by using  display:none style tags (deleting controls will eventually lead to errors as SharePoint Expects some controls to be there).Save the Site.

    *  Log into your SharePoint test setup and navigate to the site. Save the site as a template (not including content, as this will copy all documents and so on, adn I'm guessing you dont want to do that? Otherwise, copy content).

    * In you visual studio code you then search for the template name you've created with something along with this pseudo code:

    public string MyCreateSiteMethod(){

    SpSite _myRoot= new SpSite(new Uir(<insertYourURLHere>));

    SpWebtemplateCollection _templateCollection=_myRoot.GetCustomWebTemplateColleciont(<your lcid here>); 

    SPWebTemplate _template=_templateCollection[<template name here>];

    SpWeb _newWeb=_myRoot.AllWebs.Add("MyTitle","MyDescription",LCDI, _template,"lastParameterIcannotRemember"); 

    return _newWeb.Url;

    }

     Hope this helps, otherwise hollar and I'll dig out the code I used to give some precise examples

     

    Best Regards,

     /Martin

  • Sergio Mocha Profile Picture
    on at
    Re: Re: Re: Re: Re: SharePoint Document Library in an IFrame

    Hello Martin,
    At the first, I wanted to create as many document libraries as accounts in CRM without navigation menus in WSS.

    Ok, as your code, you have as many sites as "accounts". Ok, that's a solution for me, as I understand it's not possible to have as many document libraries as accounts in CRM. However, it would be possible to have one document library with different folders, each one of them would be represented by an account for example. Which method do you advise me, based on sites or folders?

    On the other hand, when you say "add the document library webpart" you mean to add web element to the page, based on document library previously created.

    I pay attention your opinions,
    Thanks

    Sergio

  • Martin Ladefoged Profile Picture
    230 on at
    Re: Re: Re: Re: Re: Re: SharePoint Document Library in an IFrame

    Hey Sergio,

     I'm not really sure what you want to achieve here? You want a doc lib per account? That should be very possible.

    A way of implementing this is to make a CRM workflow that is run when the Accounts CRM form is run. In the WorkFlow you can do all the SharePoint Logic you'd ever want, also you can pass parameters from CRM via properties in the workflow, like credentials for the execution of the sitecreation process, account name/id/whatever and so forth, and you can make an output parameter where you store the URL returned from SharePoint when the site creation process finishes. (check out this link regarding Custom .NET workflows for CRM http://nishantrana.wordpress.com/2008/10/30/custom-workflow-activities-in-crm-40/ and how to pass parameters as input/output and so forth).

    You can then update the CRM form and save a property on the form containing the url property value - how you store it in CRM isn't really my strong side - I just do the custom .NET part of it.

    Now, in your workflow logic you can do basically what you want, and how you want to do it - be it adding a lot of doc libs to the same site, or creating a site + doc lib per account (that's the way I'd do it).

    Now, to get the desired site setup and so forth, you can do two things. The site has to be a template where you've trimmed all the chrome and such away (if that's what you want). But the doc libs can be created from templates as well. Now, if you want a different type of template for each account, then you've got a lot of work to do saving all those templates, and an even bigger one remebering their names for when you have to store them somewhere you can get to that information ).

    I'd suggest you make a couple of templates for a couple of account types, and then saving their names in CRM. Like, maybe making a custom object/form called Doclib Type and then make a reference to that from the account form, and update it accordingly.

    Then I'd create my sites with the trimmed template, and then use the different Doc Lib templates to get the different types needed containing the different folders, you wanted.

    Check out this pseudo code example, hope it explains it better (for the CRM workflow part, check out the link I posted above)

    public string MyCreateSiteWithMethod(string siteTemplateName, string doclibTemplateName)

    {

    SpSite _myRoot= new SpSite(new Uir(<insertYourURLHere>));

    SpWebtemplateCollection _templateCollection=_myRoot.GetCustomWebTemplateColleciont(<your lcid here>); 

    SPWebTemplate _template=_templateCollection[siteTemplateName];

    SpWeb _newWeb=_myRoot.AllWebs.Add("MyTitle","MyDescription",LCDI, _template,"lastParameterIcannotRemember"); 

    _newWeb.DocumentLibraries.Add(<yourDocLibName>,<yourDocLibDescription>,doclibTemplateName);

    return _newWeb..DocumentLibraries[<yourDocLibName>].DefaultView.Url;

    }

    Hopes this helps,

     /Martin

  • Sergio Mocha Profile Picture
    on at
    SharePoint Document Library in an IFrame

    Hello again,

    I'm going to define my steps so you can understand me that I'd like to do.
    I have an aspx page in an CRM IFrame. This page has my code. It passes the accountid parameter through url (IFrame properties in CRM) and it creates the document library with their account name. It does successfully.

    Well, I think that I only need one template for the moment. By the moment, I would like to supress the html code to avoid the user can navigate by the site. In that moment, which's the page to modify? Do I have to create a new web page to hang the site firstly... or Can I trim all the chrome and so from site master page? I'd prefer to do a new page as I posted above, is it possible? Which is the recommendable option as you?

    At the first moment I modified the site master page with SPD to test it and now I can see the doclib without frames. Then I saved it as template and I created a site based on it, but If I try to upload a new file (doclib), the frames look like to be published again (under _layout path). Any solution for this one?

    Thanks,
    Sergio

  • Martin Ladefoged Profile Picture
    230 on at
    Re: SharePoint Document Library in an IFrame

    Hiya,

     The way I'd go about this is by making a template that I've edited in SharePoint Designer and  then using said template to create new sites with the look I wanted.

    As far as I understand the workings of the IFrames in CRM, they trime the addressbar and such from the normal browser window, so basically all your page editing should come from your asp/sharepoint sites.

    Don't forget to upload your edited master pages (if you have edited them, that is), and your templates (both doclib and site). Now, if the site looks like it's not pointing to the rigth masterpage, then you should update the MasterPageUrl and CustomMasterPage properties of the sites  you want to update. Also I've experience, that if you've made a template then you need to make sure the masterpage you used to create the template, is available with the same name when you create a site from the template, if you want to keep the changes from your master page.

    As far as I am concerned, trimming the chrome and ContentPlaceHolders runtime is a no go. It's simply too much work (I think) compared to the 5-10 minutes it takes to make a template.

     If you want to change the way the upload and display a single item looks like, you'll have to edit the generic pages that are shipped with SharePoint for these kinds of things, which I would strongly recommend you ->DO NOT <- do.

     

    /Martin

     

  • Sergio Mocha Profile Picture
    on at
    Re: Re: SharePoint Document Library in an IFrame

    Ok, but I need to hide chrome bars from upload file link (upload.aspx) in doclib, else not the user can navigate outside (site actions and more) and then the trimmed template had not sense. If you know any workaround about this, I would be interested to listen you.

    Other question I do myself that's if it's possible to create another doclib different to the actual which initially I inserted as webpart in my template, so I can create other doclib from CRM and later to change the doclib webpart url direction and title in my new site originated from template by code. I have observed that webpart has an title and url direction... I don't know if I can by code from CRM to access these webpart properties in sharepoint.
    Other possibilities are, to create one folder by account or one site by account with the same doclib... and I'd like to know if it's possible to have different doclib by account in an unique site.

    Sorry if I didn't explain very well, but I'm trying to get the best possible solution about it.

    Thanks again!

     

  • Martin Ladefoged Profile Picture
    230 on at
    Re: Re: Re: SharePoint Document Library in an IFrame

    Hi Sergio,

     First question regarding removing the navigation links. The only way  I see this happening is if you remove the navigationbar to the left in your master page, and update all the sites in your sitecollection to point to that masterpage. I haven't done it on the on the project I've worked with this on, so I honestly can't give you a solution to the problem.

     2nd question : Yes, it is possible to add more doclibs to a site from different templates, the only restriction is their name and ID. One thing you cannot do, though, is alter the site by changing template after it's been created, as far as I know. So get it right the first time. If you want to code against this, you can custom .NET code to Update CRM via  the WebService that exposes the CRM framework. Then make a property on the acconut named 'DoclibUrl' or something. Then Update that property when you chose to create doclibs.

     Best wishes,

     /Martin

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans