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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get the created folder location of SharePoint Online for a case in JS

(0) ShareShare
ReportReport
Posted on by

Hi, 

I have CRM 2013 with configured SharePoint online with it. 

On opening the form, using JS, I want to get the location of the folder created for that particular Case on SharePoint Online. 

Is there any field/entity where CRM store this location path of folder ? Or I need to create URL by using ServerURL + CaseTitle + GUID in JS ?

 

Thanks in Advance, 

Chintan Dave. 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rajkumar Rajaraman Profile Picture
    on at

    Hi Chintan,

    Is this what you are looking for?:

    blogs.c5insight.com/.../Dynamically-Set-the-Document-Location-in-Dynamics-CRM-2013-with-JavaScript

    Hope this helps.

    Regards,

    R.Rajkumar

    "Please mark my answer as verified if you found it helpful"

  • Verified answer
    Royal King Profile Picture
    27,686 on at

    Below function will return the location of the share point for the record id you send if one exists.

    function getLocationOrUrl(recordId) {

       var req = new XMLHttpRequest();

       req.open("GET", encodeURI(Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/SharePointDocumentLocationSet?$select=AbsoluteURL,Description,Name,ParentSiteOrLocation,RelativeUrl,SharePointDocumentLocationId,SiteCollectionId&$filter=RegardingObjectId/Id eq guid'" + recordId + "'"), true);

       req.setRequestHeader("Accept", "application/json");

       req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

       req.onreadystatechange = function () {

           if (this.readyState === 4) {

               req.onreadystatechange = null;

               if (this.status === 200) {

                   var returned = JSON.parse(req.responseText).d;

                   var results = returned.results;

                   for (var i = 0; i < results.length; i++) {

                       var AbsoluteURL = results[i].AbsoluteURL;

                       var Description = results[i].Description;

                       var Name = results[i].Name;

                       var ParentSiteOrLocation = results[i].ParentSiteOrLocation;

                       var RelativeUrl = results[i].RelativeUrl;

                       var SharePointDocumentLocationId = results[i].SharePointDocumentLocationId;

                       var SiteCollectionId = results[i].SiteCollectionId;

                   }

               }

               else {

                   alert(this.statusText);

               }

           }

       };

       req.send();

    }

  • Verified answer
    Community Member Profile Picture
    on at

    Thanks all but I end up by following below code.

    var casetitle, spURL, caseId;

    // geting sharepoint doc folder location
    casetitle = Xrm.Page.getAttribute("title").getValue()
    spURL = "cncdev.sharepoint.com/incident";
    caseId = Xrm.Page.data.entity.getId().replace('{', '').replace('}', '').replace('-', '');
    caseId = caseId.replace(/-/gi, '');

    var loc = spURL + casetitle + "_" + caseId;

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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 2

#1
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

#1
Shidin Haridas Profile Picture

Shidin Haridas 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans