Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

sharepoint file uploded from code not appearing with CRM record ?

Posted on by Microsoft Employee

i m uploading file to sharepoint from code and then creating SharePointDocumentLocation
record to attach document with Crm record.

I can see file uploaded to shrepoint under this folder (example):

https://mysharepoint.com/sites/canas/canas/Test%20name%203%20-%20Monthly%20Order%20-%202017_07e2fb8d-3237-e811-8181-e0071b66a1e1 

So I see file if I navigate to:

https://mysharepoint.com/sites/canas/canas/Test%20name%203%20-%20Monthly%20Order%20-%202017_07e2fb8d-3237-e811-8181-e0071b66a1e1/file.txt 

For this part first I m saving entity record, then upload document to sharepoint and in last creating SharePointDocumentLocation.


Problem is when I go to CRM record > documents I dont see document there :(

I even have tried to upload a document manually form crm but getting error:

errorsp.PNG

clicking technical details it do not shows any other details but just this message.

please help

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    Hi Maoun,

    Are you on V9? Can you check if the OOB SharePoint integration is working? It looks like the issue is not with teh code but with the OOB integration on V9.

    I have the same code which was working fine on V8 but not anymore on V9. Though I haven't verified it yet but looks like the OOB integration is broken in V9(I may be wrong)

    Hope this helps.

  • Suggested answer
    Haansi Profile Picture
    Haansi 1,431 on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    Hi Maoun,

    You should be giving name of newly created sub folder and not parent folder.

    Other option can be to use absolute url instead of relative url (by supplying complete address).

    Hope it will help.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    problem is this if I give folderName "canas" it take it as a parent folder.

    if I give value to newly created folder in crm it attach it as directly under site.

    If I give path as canas/newly created foler it throws error:

    {"The relative url contains invalid characters. Please use a different name. Valid relative url names cannot ends with the following strings: .aspx, .ashx, .asmx, .svc , cannot begin or end with a dot, cannot contain consecutive dots and cannot contain any of the following characters: ~ \" # % & * : < > ? / \\ { | }."}


  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    it is not taking exect path. it is taking parent folder and listing all files available there. Strange is if I try to give path like canas/canas it throw error:

    {"The relative url contains invalid characters. Please use a different name. Valid relative url names cannot ends with the following strings: .aspx, .ashx, .asmx, .svc , cannot begin or end with a dot, cannot contain consecutive dots and cannot contain any of the following characters: ~ \" # % & * : < > ? / \\ { | }."}


  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    OK. That's what I was looking for.

    It seems like your configuration is correct.

    I think in the code you specified, doc.RelativeUrl should be only "canas".

    IOrganizationService org = GetOrganizationService(ref log);

    SharePointDocumentLocation doc = new SharePointDocumentLocation();

    doc.RegardingObjectId = new EntityReference(canas.EntityLogicalName, new Guid(recordGuid));

    doc.Name = recordGuid;

    doc.RelativeUrl= folderName; //This should be the value of canas

    doc.ParentSiteOrLocation = new EntityReference(SharePointSite.EntityLogicalName, siteId);

    org.Create(doc);

    If you add the above code, what are the results in your entity?

    Only after you do this you upload the doc.

    Let me know.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    it is :

    mysharepoint.com/.../canas

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    Maoun,

    There is an Entity called SharePoint Site in CRM.

    I am not looking for the values inside of SharePoint, but for the values inside of CRM.

    What is the SharePoint Site Url inside of CRM?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    thanks Aric,

    I may be wrong will try to explain.

    From SP basic site url is :

    mysharepoint.com/.../canas

    Under this site I m trying to create a folder to represent entity (entity name is also canas) so URL will like:

    mysharepoint.com/.../canas

    Under it a folder will be created for individual canas record so URL will be:

    mysharepoint.com/.../Test%20name%203%20-%20Monthly%20Order%20-%202017_07e2fb8d-3237-e811-8181-e0071b66a1e1

    and file url will be:

    mysharepoint.com/.../file.txt

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    Hi Maoun,

    Sorry I didn't get back to you yesterday. Seems like we are in different time zones.

    By parent entity I mean the SharePoint Site.

    SharePoint Integration is made from SharePoint Site and Document Locations entities.

    The SharePoint site is the document center site information that is stored in Dynamics CRM.

    Can you please provide us with that information?

    Is it https://mysharepoint.com or mysharepoint.com/.../canas

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: sharepoint file uploded from code not appearing with CRM record ?

    thanks Hemant, you are right but question is without / how i can give url. My site is mysharepoint.com/.../canas  

    but files are here:

    mysharepoint.com/.../name_guid

    help pleace.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans