is their any rest API to get changes for changeTypes = RoleAdd, RoleDelete, RoleUpdate and ScopeDelete via getChanges method in SharePoint Online - sharepoint-online

I have done changes related to permissions level like created permission, updated permission in my SharePoint site, but when I am trying to get the changes via REST API through this query in Postman https://site_url/_api/site/getChanges?query={ '__metadata': { 'type': 'SP.ChangeQuery' }, 'Item':true, 'Add':true, 'Update':true, 'RoleAssignmentAdd':true, 'RoleDefinitionAdd':true, 'RoleDefinitionUpdate':true, "ChangeTokenStart": {'__metadata':{'type':'SP.ChangeToken'}, 'StringValue':'1;1;6e139bba-0c8d-4eee-bdbd-d3c5dae7fd72;637967436403100000;246144216'},"ChangeTokenEnd": null } } not able to get the changes related to the above mentioned changeType enumeration. SP.ChangeType enumeration | Microsoft Docs

Related

SharePoint REST API Setting CheckoutUser using ValidateUpdateListItem()

I am trying to update the CheckoutUser for a file in SharePoint because when the file is checked out in my code, it is being checked out by a SharePoint admin account and I want the CheckoutUser to show the person who actually checked it out. Whenever I make a request to _api/web/GetList(#path)/items(id)/ValidateUpdateListItem()?#path='/url' with the user info, I get a 200 response back and no errors, but for some reason the CheckoutUser value is cleared instead up updating to be the user that I want to set. This is what the request body looks like:
{
"formValues": [
{
"FieldName": "CheckoutUser",
"FieldValue": "[{'Key': 'i:0#.w|user.name'}]"
}
],
"bNewDocumentUpdate": true
}
I have tested out requests to both SharePoint 2016 and SharePoint Online using Postman and have not been able to get the CheckoutUser to update in either case.

Creating nested folder in Sharepoint with Graph API fails

I can create a nested folder /folder1/folder2 in (personal) OneDrive with the following Graph request (using the beta API):
POST drives/{id}/root:/folder1:/children
{
"name": "folder2",
"folder": {},
"#microsoft.graph.conflictBehavior": "fail"
}
Here, folder1 didn't exist beforehand; the one API call creates both it and folder1/folder2.
However, the same code fails for SharePoint and OneDrive for Business with a 404 error. Is this type of request supported? I'd rather not have to make a separate API call for every level of nesting.
I'm asking this because I'm not sure whether my site has policies that cause the request to fail, or because the API actually doesn't support it.
This works for me. Remove name parameter from the body and use PATCH instead of POST. Specify the path in the URL.
PATCH drives/{id}/root:/folder1/folder2
{
"folder": {},
"#microsoft.graph.conflictBehavior": "fail"
}
Tested using v1.0 and beta for OneDrive for Business.

What is the Sharepoint Document Location endpoint really returning?

I'm trying to get the OneNote notebook information that is linked to my organization's CRM accounts. Each account has a OneNote book created for it that can be accessed inside of CRM.
From what I understand, I can use the SharePointDocumentLocation endpoint (found here: https://learn.microsoft.com/en-us/dynamics365/customer-engagement/web-api/sharepointdocumentlocation?view=dynamics-ce-odata-9) to get the location of the specific file if I ask for location type to be 1.
However, SharePointDocumentLocationId and SiteCollectionId don't seem to be pointing to anything on my company's sites. Should I be getting my data somewhere else?
I started searching through my company's SharePoint structure to see if I can get any hints as to where these documents may be located. My initial Postman request (getting the sites off of the root site) don't show the site that hosts our CRM documents (sites/crmdocs). I was able to find where this was stored eventually, but trying to get the OneNote notebooks stored there returns an error since we have more than 20,000 notebooks there, so I can't fetch them all. As far as I know, I'm able to get notebooks if I have the specific ID I want.
Once I fetch the CRM information, I try to send a request like this:
https://graph.microsoft.com/v1.0/sites/{myCompanyUrl},{siteCollectionId},{sharepointDocumentLocationId}/onenote/notebooks/
SiteCollectionId and SharePointDocumentLocationId are from my CRM SharePointDocumentLocation request
The error I receive is:
The requested site was not found. Please check that the site is still accessible.
Assuming your environment is using the out of the box sharepoint site and sharepoint document location hierarchy, you can access One Note files using the following link structure:
[SharePointAbsoluteUrl]/[EntityLogicalName]/[RelativeUrl]_[RegardingObjectId]/[RelativeUrl]
How to get [SharePointAbsoluteUrl] :
Querying for sharepointdocumentlocations is actually not enough because Dynamics 365 stores this information in another entity called sharepointsite. This is how you can obtain it:
var query = new QueryExpression("sharepointsite")
{
ColumnSet = new ColumnSet("absoluteurl")
};
query.Criteria.AddCondition("IsDefault", ConditionOperator.Equal, true);
var entityCollection = _service.RetrieveMultiple(query);
var absoluteUrl = entityCollection[0].Attributes["absoluteurl"];
In Web API it is equivalent to:
GET https://[Your Org]/api/data/v9.0/sharepointsites?$select=absoluteurl&$filter=isdefault%20eq%20true
There can only be a default sharepoint site so this query will return a single record.
How to get the remaining parts:
Fetch for sharepointdocumentlocations that have Location Type dedicated to One Note Integration:
var query = new QueryExpression("sharepointdocumentlocation")
{
ColumnSet = new ColumnSet("regardingobjectid", "relativeurl")
};
query.Criteria.AddCondition("locationtype", ConditionOperator.Equal, 1);
var entityCollection = _service.RetrieveMultiple(query);
In Web API it is equivalent to the following get request, don't forget to add add Prefer: odata.include-annotations="*" to your HTTP Request Headers so that it gets the lookup lookuplogicalname field:
GET https://[Your Org]/api/data/v9.0/sharepointdocumentlocations?$select=relativeurl,_regardingobjectid_value&$filter=locationtype%20eq%201
This query can return many records, I've only used the first one in the examples below for explanation purposes.
[EntityLogicalName] will be your ((EntityReference)entityCollection[0].Attributes["regardingobjectid"]).LogicalName;
In Web Api will be your value._regardingobjectid_value#Microsoft.Dynamics.CRM.lookuplogicalname value.
[RelativeUrl] will be your entityCollection[0].Attributes["relativeurl"];
In Web Api will be your value.relativeurl value.
[RegardingObjectId] can be obtained with this expression ((EntityReference)entityCollection[0].Attributes["regardingobjectid"]).Id.ToString().Replace("-", "").ToUpper();
In Web Api id will be your _regardingobjectid_value value and you have to remove dashes and convert it to upper case in whatever language you are doing the request.
You should end up with an URL like this https://mycompany.sharepoint.com/account/A Datum Fabrication_A56B3F4B1BE7E6118101E0071B6AF231/A Datum Fabrication

docusign api - ACCOUNT LACKS PERMISSIONS exception when creating an enveloppe with display or signerMustAcknowledge

I'm trying to create an envelope with a main document and several other supplementary ones via the REST API (on the POST /envelopes point).
Works fine except that i'd like to display some docs as supplementary one (asking for a view or view and accept)
Problem is that I cannot set the display / signerMustAcknowledge document property, got an ACCOUNT LACKS PERMISSIONS exception letting me know specifically that these 2 property are forbidden. Does anybody ever had such an issue ?
{
:status=>"sent",
:eventNotification=>{
:enveloppeEvents=>["Sent", "Delivered", "Completed", "Declined", "Voided"],
:url=>"http://requestb.in/16wh0yw1"},
:emailSubject=>"Sale pack",
:recipients=>
{
:signers=>[
{
:email=>"me#gmail.com",
:name=>"Nicolas",
:recipientId=>1,
:clientUserId=>1447,
:tabs=> {
:signHereTabs=>[{..., :required=>true}],
:dateSignedTabs=>[{..., :required=>true}],
:textTabs=>[{..., :required=>true}]
}
}
]
},
:documents=>
[{:name=>"doc 1",
:documentId=>1,
:fileExtention=>"pdf",
:documentBase64=> '...'
:includeInDownload => true,
:display => 'modal',
:signerMustAcknowledge => 'view'
}]
}
=> RestClient::BadRequest: {
"errorCode": "ACCOUNT_LACKS_PERMISSIONS",
"message": "This Account lacks sufficient permissions. Account does not have permission to set 'display' or 'signermustacknowledge' properties on document facture.pdf (Purchase)."
}
Thanks in advance ! Nicolas
EDiT : i'm using the legacy authentication with my integration account (within the request header ). Account is a demo one created a week ago, and request is post on /envelopes
At this time, Dec 22, 2016, the default permission set for new demo accounts does not include the Supplemental Documents feature.
Solution:
If you have a sales or technical contact at DocuSign, ask them to add the Allow Supplemental Documents permission to your demo account.
If you don't have such a contact, file a case with DocuSign support
I anticipate that the permission will be included with new demo accounts in the future, but we're not quite there yet.

Foursquare API : edit / Propose edit not working

I am manager of the testing location.We're testing with the 'Propose Venue Edit' method and we're not seeing the name change with our test location.
I get this response from API
URL : https://api.foursquare.com/v2/venues/55c0b1ec498e7261dfb1e42c
/edit?v= 20150804&name=TESTING_HOTEL&oauth_token={token}
Request Paratmeter:
{
VENUE_ID: "55c0b1ec498e7261dfb1e42c",
name: "Testing Venue"
}
Response :
{"meta":{"code":200},"notifications":[{"type":"notificationTray","item":{"unreadCount":0}}],"response":{"woes":[]}}
Is there any verification required after update to reflect changes on venue OR Venue must be verified before update? I can able to perform edit Testing Venue, it is reflated instantly from web but not from Foursquare API.
Thanks,
Bhargav Kukadiya

Resources