I'm trying to utilize MS Power Automate to automatically create a New List Item on my Sharepoint 2019 List from responses in MS Forms. I'm using the template "Record form responses in SharePoint" and am stuck in the Create Item step.
The Sharepoint Subsite URL and List Name produces an error:
The dynamic operation request to API 'sharepointonline' operation
'GetTable' failed with status code 'Unauthorized'. This may indicate
invalid input parameters. Error response: { "message": "Access token
not found clientRequestId: 4162a960-da54-470d-90e7-fae4a4c404cb",
"fromPolicy": true }
I've also noticed some unusual characteristics on the URL format which is https://share.domain.com/teams/x/x/x/Subsite
Which is quite different from the common Sharepoint URL formats:
https://domain.sharepoint.com/sites/sitename
I would like to know how to get past this error.
Any help is appreciated.
Thanks!
Related
I'm using the following api to successfully get file data:
https://acme.sharepoint.com/sites/my-site/_api/Web/Lists(guid'xxx')/files('yyy')
This is a docx file on which I've posted comments using the web console.
How can I fetch these comments using the rest api? I tried appending /comments to the url, but I'm getting the following 404 error:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException",
"message": {
"lang": "en-US",
"value": "Cannot find resource for the request Comments."
}
}
}
The Comments() endpoint currently exists only under the Items() endpoint and not under the Files() endpoint.
Basically, you can access the Comments() functionality only under the below endpoint:
GET https://{site_url}/_api/web/lists/GetByTitle({list_title})/items({item_id})/Comments
You can easily test the above in a PowerAutomate scenario with a Send Http Request to SharePoint actions.
In the below example I attempt to target the file in the document library:
On the other hand, if I attempt to target the file based on the List Item Id that it got in the document library I will get the below response:
As you can see from the above, I am also able to target a specific comment that I left.
Please take note of the below
The Comments() endpoint is not available for MS resources, meaning docx, excels and such files. It is only available for non-MS resource files like pdfs, txts and so on. I am not sure why this rule is in effect but, my best guess would be because there is a "commenting" functionality provided within a Word Document, for example.
You could find a bit more info about the above here.
https://graph.microsoft.com/beta/sites?search=* fails with error
{
"error": {
"code": "BadRequest",
"message": "Syntax error: character '' is not valid at position 0 in ''.",
...
}
}
However on 1.0 ((https://graph.microsoft.com/v1.0/sites?search=*)) this works fine and returns all the sites associated
Our application relies on this API to fetch all the sharepoint sites associated with a company. Is the beta behavior a bug?
The beta endpoints are currently in preview and are not yet generally available, it may be not suitable for the production environment.
If you want to fetch all the sharepoint sites, you may consider using following workaround:
There is a list in tenant-admin site that stores a cached copy of aggregated site collections data from all contentdb.
Get tenant -admin site:
Find the lists: DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECO and DO_NOT_DELETE_SPLIST_TENANTADMIN_ALL_SITES_AGGREGA
These lists contain all site collection info.
One list includes personal site and another does not.
I am an owner of a Sharepoint site and want to make sure all members of the site don't upload video files. Since SP doesn't have the ability to filter out files by Type - I want to use Microsoft Flow to do this task.
So I have created this flow which triggers on creation of new file in Documents folder of my SP site. Then it runs a Condition, which checkes the property of "File content type" - if it starts with "video/" - then it should delete the file uploaded. It looks like this:
#startsWith(triggerOutputs()['headers']['Content-Type'], 'video/')
But when I run this Flow, I then get this error:
BadRequest. The request failed. Error code: 'InvalidRequestContent'. Error Message: 'The request content was invalid and could not be deserialized: 'Unexpected character encountered while parsing value: {. Path 'details', line 1, position 455.'.'.
What am I doing wrong?
Unfortunately there is no OOTB way to configure these settings yet. Your workaround to create a flow is just what I would have suggested. Ofcourse you can also still create a workflow that does that but why old fashioned if you already made your experience with flow.
This is a known issue and I would encourage you to vote for that feature here.
In OneDrive you can restrict certain file types from syncing using the poweshell:
Set-SPOTenantSyncClientRestriction -ExcludedFileExtensions "wmf;mp4;mkv"
For your flow I would suggest to make an extra step "get file content" and use the content type you get there for your filter instead of the one from your "triggerOutputs"
I am trying to get all users in an office location using Microsoft Graph
I am receiving the following error message:
Unsupported or invalid query filter clause specified for property 'officeLocation' of resource 'User'.
I am using the following uri and filter:
https://graph.microsoft.com/v1.0/users?$filter=officeLocation eq '18/2107'
at the graph explorer here:
https://developer.microsoft.com/en-us/graph/graph-explorer
How can I pull all users for an Office Location?
Thanks!
Unfortunately this property on user is not filterable. If this is something important, please file a request for this on Uservoice: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis
Hope this helps,
Filter on officeLocation is not available till date, we can query for all user than can filter out from that based on officeLocation, API will not return all user in one call, Microsoft Graph will continue to return a reference to the next page of data in the #odata:nextLink property with each response until all pages of the result have been read.You can retrieve the next page of results by sending the URL value of the #odata:nextLink property to Microsoft Graph.
My code calls the OneNote API to resolve a SharePoint Online site URL to a SiteCollectionId and SiteId. We get a bearer token, set the HTTP auth header and issue a GET request to:
https://www.onenote.com/api/v1.0/myorganization/sitecollections/FromUrl(url='https://mytenantxyz.sharepoint.com/sites/copynotesite')
For approx a week, it has been returning the expected response, similar to:
{
"#odata.context": "https://www.onenote.com:576/api/v1.0/$metadata#Microsoft.OneNote.Api.SiteMetadata",
"siteCollectionId": "111e03ac-468c-4a28-9aab-543098ef49bb",
"siteId": "555d72a0-f82f-4e4c-ae8a-17ef0ea04f32"
}
However, today it has decided to return the following in approx 9 out of 10 requests:
{
error": {
"code" : “20158”,
"message": "Unable to get SiteMetadta for the url specified in the request.",
"#api.url": "http://aka.ms/onenote-errors#C20158"
}
}
The Microsoft docs (link) explain error 20158 as:
"Unable to get metadata for the site URL specified in the request. Check the format of the supplied URL. Supported formats include https://domain.sharepoint.com/site-a and https://domain.com/sites/site-a. (SharePoint support is in Preview.)"
I was unaware that this was in preview any more (I thought it was GA), but anyway it doesn't explain why it intermittently works for exactly the same input (same URL and bearer token).
Could it just be a bug in the OneNote API or SharePoint API that it must call under the covers?
Please refer to the blog - http://blogs.msdn.com/b/onenotedev/archive/2015/06/11/and-sharepoint-makes-three.aspx
We added the FromUrl method so you can pass in an absolute site URL and get the site collection and site IDs. You should make this call only when needed, and then store the values (site collection and site IDs) for future use in your requests to the OneNote API.
this however does not answer intermittency. Please share the X-correlationId header with us for a failing request so that we can help further.