SharePoint - retrieve sharing links for a folder - sharepoint

I have SharePoint folders that are shared with external users.
The sharing is created using ShareDocument() in OfficeDevPnP.Core.
(Thanks to Jack Le for answering my earlier question on how to do this)
I now want to retrieve the email addresses that a folder is shared with, ie this list:
[]
I've tried these methods, but can't get the information I require:
GetSharingLinkData()
GetSharingLinkKind()
GetObjectSharingSettings()
GetObjectSharingSettingsForDocument()
Is there a way to retrieve the email addresses?

There is a rest api endpoint that could offer this kind of info.
_api/web/Lists(#a1)/GetItemById(#a2)/GetSharingInformation
Refer to below blog to get more details:
https://cann0nf0dder.wordpress.com/2018/04/04/externally-sharing-getsharinginformation-rest-api/
BR

The rest call above and described on Cann0nf0dder web site only works in the browser when using Sharepoint interface. If you try it programmatically it results in "Method not allowed". I don't think it is useable.
Below is a list of usable commands in the Sharepoint rest interface, and GetSharingInformation is not one of them:
https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/jj860569(v=office.15)?redirectedfrom=MSDN

The answer of Billy Bonkers is not correct: The decribed REST endpoint of Cann0nf0dder can be used.
He has used it on the next part of the series: https://cann0nf0dder.wordpress.com/2018/04/05/externally-sharing-spfx-isexternallyshared-field-customizer
"Method not allowed" error is a result when using wrong HTTP-Method: POST must be used.
In dependence of the scenario you must additionally provide a FormDigest manually:
execute a POST request to /_api/ContextInfo
get the FormDigestValue property from the resulting JSON
use this value to set the X-RequestDigest header property for the /_api/web/Lists(#a1)/GetItemById(#a2)/GetSharingInformation POST request

Related

How do i fetch only internal messages from O365 using Graph API

I wan't to fetch only messages that are only internal to organization.
Right now the way i see is fetch domains first then for each message see if from/sender domain belongs to that message , based on that differentiate.
But this is lengthy process and not a foolproof technique.
Is there any GRAPH API query i can use which readily provides this ?
It does not apear that the REST API queries for Office 365 includes this information directly in the messages. From the Version 2.0 And the Beta this is not included in message output.
However, it looks like you might be able to get it from the REST API via the headers.
Try the following query:
https://graph.microsoft.com/beta/me/messages?$select=internetMessageHeaders&$top=1
This takes top one messages and shows you the email header of the message.
In the header look for X-OriginatorOrg. The value should be the main domain of your organisation.
Alternatively you can look at the X-MS-Exchange-Organization-MessageDirectionalityheader. If the value here is Originating it should come from inside your own organisation.

For Azure DocumentDB input binding, Is there a way to get the document id from the headers?

I am trying to use Azure function to automate a process, where by a third party send me a http request with document id in the http header. I want to use that id to use documentdb input binding.
I have already learnt that we can do it from the body. Thanks to Brett Samblanet for replying on the Azure documentation itself.
Alternatively I can redirect it further by putting "document id" into the query string, that will be bit inefficient but still better than not being able to use it at all. So it will be great If anybody can please help me to find out a way to:
use http header as document id.
use query string as document id.
At the moment you can only bind to values from the request body. We have a PR already merged that expands this to allow binding to the query string as well. But this change is not currently in production (I can update this response when it is): https://github.com/Azure/azure-webjobs-sdk-script/pull/568
There is currently no support for headers but I've filed an issue: https://github.com/Azure/azure-webjobs-sdk-script/issues/591
FYI -- I also copied this answer here: https://azure.microsoft.com/en-us/documentation/articles/functions-bindings-documentdb/

Office 365 Unified API Exchange folders

I'm starting to look at the new Office 365 Unified API (specifically around Exchange for the moment).
In the existing Mail API at you can make an authenticated call to https://outlook.office365.com/api/v1.0/me/folders/Inbox/messages in order to get messages in the Inbox. You can also hit folders/Drafts/messages, folders/SentItems/messages and folders/DeletedItems/messages to retrieve messages from Drafts, Sent Items and Deleted Items respectively. This is documented at https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#AllMailAPIoperations.
Problem is, I can't find (either in documentation at https://msdn.microsoft.com/office/office365/HowTo/office-365-unified-api-reference#msg_ref_relationship_Messages or by messing about on https://graphexplorer2.azurewebsites.net) how to drill into these folders when accessing via the Office 365 Unified API.
The documented URL to access messages via the new Unified API is https://graph.microsoft.com/beta/me/Messages, and so I was hoping I could hit something like Messages/Inbox or Messages/folders/Inbox, but no luck so far.
Does anyone know if these paths are currently missing or addressed differently, or if it's the intention that you find what you want by using $search rather than drilling into specific folders?
This isn't currently supported in Unified API, but is high on our priority list, and we are working on it. Sorry for the confusion. You can continue to use outlook.office365.com endpoint for now, to access folder info.
Having checked back (and read through https://graph.microsoft.com/beta/$metadata) this has now been implemented. You access folders via MailFolders/[folder name]/messages, so:
https://graph.microsoft.com/beta/me/MailFolders/Inbox/messages
https://graph.microsoft.com/beta/me/MailFolders/Drafts/messages
https://graph.microsoft.com/beta/me/MailFolders/SentItems/messages
..etc.

Retrieve a mailchimp list via GET

I am trying to retrieve a MailChimp list.
I have an API Key and a List ID, and while I understand that I can use the MailChimp API wrapper to achieve this I prefer to avoid implementing it since I only need to do this one task.
When I enter in my browser:
https://us3.api.mailchimp.com/2.0/lists/members?apikey=*****&id=******
I get a JSON result of my list - but it is limited to the first 25 subscribers. I don't see anything in the MailChimp API documentation about submitting a GET request to retrieve a list. Is it possible to do so? If so, how can I retrieve a full list?
Read this: http://apidocs.mailchimp.com/api/2.0/lists/members.php
Options are available via pagination.
You are supposed to POST the values in your request.
Looks like the best method is to use the MailChimp list method which "Exports/dumps members of a list and all of their associated details. This is a very similar to exporting via the web interface."
Read more at http://apidocs.mailchimp.com/export/1.0/list.func.php
Another option is to use API v1.3 listMembers function, more info here: http://apidocs.mailchimp.com/api/1.3/listmembers.func.php. v1.3 is deprecated, but it still functions properly.

Add special via foursquare api, got code 200 but special doesn't show up

I am trying to add a special via the foursquare api Add special endpoint.
I am generating a proper POST request and getting a similar response to what the api should return. But it still wont show up on the specials on foursquare.
Do I need to add a campaign too for it to show up?
This is the response object I am getting:
{"meta":{"code":200},"notifications":[{"type":"notificationTray","item":{"unreadCount":0}}],"response":{"special":{"id":"51ed8c2a498e821be0469850","type":"friends","status":"New
- in review","count1":10,"name":"Friends Special...!","text":"Everyone gets free cookies??","unlockedText":"hgc","autoRedeem":false}}}
Any ideas on what needs to be done?
PS: I am able to add a special manually on foursquare!!
This venue is an office and according to this api doc offices and homes aren't allowed to add specials. This is a bit of a conflict.
Is it that offices are not allowed to add specials only via the API since I am able to create a special manually on foursquare.
Alright so, got the answer.. Create a special then create a campaign works!!
But I'm still wondering how I was able to add a special when the documentation clearly says that homes and offices aren't allowed to do so!

Resources