How to programmatically set a Retention Label on an email in M365 - microsoft-graph-api

Is it possible to set a Retention Label or Retention Policy on a mail item? Can it be done through MS Graph? If not, can it be done any other way? I can see that the Outlook Web App can set a retention label.

You could try to stamp a retention tag on a item using singlevalueextendedproperties (eg Retrieve SingleValueExtendedProperties with MS-Graph API created with EWS) like you could in EWS https://learn.microsoft.com/en-us/archive/blogs/akashb/stamping-retention-policy-tag-using-ews-managed-api-1-1-from-powershellexchange-2010 (One note is ComplianceTags are new feature since the old EWS method)

Related

Query deleted records via SF OData API?

I am replicating the Successfactors Employee Central Data (including FO, MDF, BG elements and etc.) via OData API to local database for third party integration.
It is able to trace changed records by filtering last modify date. However, the deleted record is not able to capture from OData API. Hence I cannot delete the record in my local database when corresponding EC record is deleted.
Is there any way I can get the deleted records from the API or other sources? Thanks.
OData API is not able to handle this task.
Extract from SF OData API doc:
Don't use our OData APIs when:
● Your system cannot consume either OData APIs or SOAP for an initial data load. In this case, you would go
for Import/Export with a CSV. Automation via FTP would also be a possibility.
● You need employee replication field level delta, snapshot, or read modified employees only, then SOAP Compound Employee API is your tool of choice. You can find more information in the guide Implementing the Employee Central Compound Employee API.
● You only need to read data, then the SOAP Compound Employee API would also be your tool of choice.
However with SFAPI (SuccessFactors CompoundEmployee API) it's easy. SFAPI has a special parameter changedSegmentsOnly that does exactly just what you want, the API returns only changed segments with an action code not equal to NO_CHANGE in delta transmission.
You make a query, for example, for changed employee data:
<urn:query>
<urn:queryString>select person,
personal_information,
address_information,
email_information,
phone_information,
employment_information,
job_information,
compensation_information,
paycompensation_recurring,
paycompensation_non_recurring,
direct_deposit,
national_id_card,
payment_information
from CompoundEmployee
where person_id_external = 'cgrant'
</urn:queryString>
<urn:param>
<urn:name>resultOptions</urn:name>
<urn:value>changedSegmentsOnly</urn:value>
</urn:param>
<urn:param>
<urn:name>maxRows</urn:name>
<urn:value>50</urn:value>
</urn:param>
</urn:query>
This API query will return you all the employees that were changed or deleted.
After that you can filter your response by that field.
ADDENDUM: any change to MDF entity, both standard and custom, can be tracked via OData Audit logs. How to enable them:
Go to this setting in API center
Enable this switch. It can be enabled for SFAPI as well
This way all API calls payloads will be saved and you will be able to see what entity was changed with each call
Prerequisite: the object must be visible by API and MDF version history must be enabled
More about API types for SuccessFactors:
SAP Note 2613670
OData API reference Guide
SFAPI reference Guide

How can I create a M365 Group with a specific Preferred Data Location (PDL) using the Microsoft Graph API

I'm trying to programmatically create an M365 group with a Preferred Data Location that is different from the tenant default using the Graph API. I am trying to pass the PDL in via a PowerShell script, but when I add this command, I get a 403 Forbidden error of "InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException"
Has anyone successfully used the Graph API to create a Group (and eventually Team) in a non-default PDL?
Some technical background:
The tenant is Geo-enabled, and users have default PDLs. Default location is US, trying to create the group in CAN
Group creation is happening via a PS Script
PS script is using AAD app permissions, and has appropriate Directory.readwrite.all permissions, etc.
My script works perfectly in creating a group right I don't try to add the preferredDataLocation parameter. It only fails when I enable this specific parameter in the request body.
Thanks everyone!
As per the docs, the property preferredDataLocation can be set on the group while creating it or updating it through the REST API. Add this property in your request to the preferred data location for the group. Described here

Webhooks v/s polling for all users drives' within an Org (multi-tenant) - MS Graph

We are going to have a multi-tenant application that is going to be scanning files for each user per organization for multiple orgs. We would like to get notification if any user uploads/changes a file in the drive. There are at-least 2 options to retrieve those: either store delta link for each user and poll periodically to get the change or subscribe using webhooks to get notification on change. If we have 10k+ users, I am not sure if the first option is feasible. For the latter one, my only concern with webhook is do I have to register for each user separately? ie., does the resource need to be /users//drive/root or should it just be /drive/root? Since there is a limitation of no. of webhooks per app/tenant, I am not sure if creating webhooks for each user is a right approach.
Please advise.
The limitation applies to the users/groups objects (i.e. if you wanted to subscribe to users/groups being updated), not to the drives.
Yes, you need to subscribe to each drive individually, and to renew the subscriptions individually as well. If you want to save the number of roundtrips, you can group those operations in a batch.
You can also combine the delta + webhooks: do the initial sync with delta and store the token, register your webhook. And then trigger querying the delta link upon receiving a change notification. This way you get the best of both features and avoid regularly polling delta when there might not be any change.

Microsoft Graph API question: how do I get event instance data via iCalUId

Here's my problem: I am using Microsoft Graph API v1.0 and would like to get the details of an instance of a recurring calendar event. All I got is the iCalUId of the instance.
I tried this call:
https://graph.microsoft.com/v1.0/me/events?$filter=iCalUId eq 'the value of the iCalUId'
This was also suggested in Microsoft graph API: finding event by iCalUid.
This works fine for single events.
But it does not work for instances of recurring meetings: then the call returns an empty value. I just verified this in the Graph Explorer https://developer.microsoft.com/en-us/graph/graph-explorer
Am I doing something wrong (even though the iCalUId is unique to the instance)? Is there a different call I could use?
This is happening because instances of recurring meetings don't actually exist on the server. When you use the /me/events endpoint, you are getting only single-instance and series masters events - it does not trigger the server to expand recurring events into individual instances.
To get server-side expansion, you have to use the /me/calendarview endpoint. This does require that you specify a date range though. For example, this works:
GET /me/calendarview?startDateTime=2020-01-31T00:00:00
&endDateTime=2020-02-29T00:00:00&
$filter=iCalUId eq '040000008200E00074C5B7101A82E00807E40204756DC3EEFFE5CC01000000000000000010000000FCE197631C1A2E4C89172A4115BEB7B5'

Jenkins Pipeline, retrieve information from JIRA ticket

I was just wondering if there was anyway to retrieve information from a Jira ticket and assign it to a variable in Jenkins.
So (just an example) - I'd like to save label from a ticket as $Jira_Label
You can send a REST request to JIRA and retrieve the information, like the label, of a specified issue.
Here there is the list of the available requests you can send.

Resources