locked
Creating folders programmatically from crm 2013 to sharepoint 2013 document library. RRS feed

  • Question

  • Dear all,

    I have dynamics crm 2013 on-premise installed and sharepoint 2013 installed.

    I am creating a plugin which will create a document folder automatically when an account is being created.

    The folder is not being created.

    Can anyone help?

    Plaese find below my code:

    "

                  

     IOrganizationService service = factory.CreateOrganizationService(context.UserId);

                                _clientContext = new ClientContext(_siteUrl);
                                _clientContext.Credentials = new System.Net.NetworkCredential("administrator", "?admin123", "mydomain.local");
                                Web web = _clientContext.Web;

                    _clientContext.Load(web);
                    _clientContext.ExecuteQuery();

                    List newList = web.Lists.GetByTitle(documentLibraryName);


                        FolderCollection foldcoll01 = web.Folders;
                        foldcoll01.Add(_siteUrl + "/" + documentLibraryName + "/" + strAccountName);
                        newList.Update();

    Can anyone help me please.

    Thanks & Regards

    Vinay

    Wednesday, October 16, 2013 1:46 PM

All replies

  • Hi,

    You must create both a SharePoint folder and a Document Location record to point to this folder. Use the out of the box folder creation and look at the Document Location record structure it creates - you will need to replicate this.

    hth,

    Scott


    Scott Durow
    Blog www.develop1.net    Follow Me
    Rockstar365
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Friday, October 18, 2013 9:54 AM
    Answerer
  • Hi,

    Agree with Scott's response, Please check the following link

    http://vikramxrm.blogspot.com/2013/01/ms-crm-2011-integration-with-sharepoint.html


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !
    Vikram !

    Friday, October 18, 2013 9:59 AM
  • Hi Vinay, 

    I have dynamics crm 2013 and sharepoint 2013 online.

    I wanna to create 6 document folder automatically when an account is being created.

    Can anyone help?

    Thanks
    CC


    • Edited by CunhaX Tuesday, May 6, 2014 11:41 AM
    Tuesday, May 6, 2014 9:53 AM
  • Hi , I'm using CRM 2013 ONLINE and sharepoint online and

    i'm trying to create 6 subfolders automatically for each record, after the record folder is created..

    Is it possible to do it ONLINE??? How?

    Monday, May 12, 2014 3:56 PM
  • Hi , I'm using CRM 2013 ONLINE and sharepoint online and

    i'm trying to create 6 subfolders automatically for each record, after the record folder is created..

    Is it possible to do it ONLINE??? How?

    Monday, May 12, 2014 3:56 PM
  • Did you find out about this yet? I would like to know the answer as well.
    Friday, May 16, 2014 10:38 PM
  • Hi Vinay,

    Here is your solution:

    http://www.powerobjects.com/blog/2013/03/05/create-crm-2011-sharepoint-sub-folders/

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Help

    • Proposed as answer by Adeel Aqdus Monday, May 19, 2014 12:00 AM
    Sunday, May 18, 2014 11:59 PM