I need to save a custom property from my outlook add-in and retrieve the this value from graph Api.
I followed MS documentation, this link and this one.
I store the custom property with office.js methods loadCustomPropertiesAsync and customProps.saveAsync
I have checked the value is correctly stored to custom properties (I can read it from add-in when I come back to event)
When I try to check the value from graph API, the event is returned without custom props.
here is the request I use :
{{endpoint}}/Users/bc2d0290-xxx-4041d2d39b66/Events/AAMkADI1YTJjZTI1LWM4YjUtNxxxTvAAA=?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name cecp-myAddInManifestId')
What am I doing wrong ?
I found my mistake.
I use custom properties to enrich appointements with conference room.
I tried to retrieve custom props on my server from room eventId instead of organizer eventId
Related
Some of the Graph API return a lot of data and require paging. Exists a lastModifiedDateTime property to get only changed rows, such as to make this call that returns users who are modified since a given date?
https://graph.microsoft.com/beta/users?$filter=lastModifiedDateTime gt '2020-01-01T12:00:00Z'
or get the classes that have changed (Educational API)
https://graph.microsoft.com/beta/education/classes?$filter=lastModifiedDateTime gt '2020-01-01T12:00:00Z'
The Property you are trying i.e., 'lastModifiedDateTime' is not part of the MS Graph.
In Ms Graph this is possible with directoryAudits method which contains all information related to changes(logs) in Azure AD.
To Get the last activity in azure you need to use 'activityDateTime' property and to get the user information 'initiatedBy' property.
It seems that the Microsoft Graph search functionality for driveItem doesn't return a #mcirosoft.graph.downloadUrl
Using the Graph Explorer, I tried to fetch the following and the downloadUrl isn't present in the response:
/v1.0/sites/{site-id}/drive/root/search(q='')?$select=id,name,file,folder,size,lastModifiedDateTime,#microsoft.graph.downloadUrl
In the documentation, the DriveItem should include the #microsoft.graph.downloadUrl on the response.
The select query parameter applies only to properties, not instance attributes. Instance attributes are properties with special behaviors.
In your query, id,name,file,folder,size,lastModifiedDateTime are valid properties but #microsoft.graph.downloadUrl is an instance attribute.
In order to obtain the downloadUrl, you will need to execute a second call to /v1.0/sites/{site-id}/drive/items{driveItemId}.
In Graph Explorer if i make a request to:
/v1.0/users/[User.Id]/drive/root/children?$select=*,sharepointIds
I do not get back the sharepointIds property from MS Graph.
If I remove * from select query parameter and only request sharepointIds property then I get the sharepointIds property and its values.
v1.0/users/[User.Id]/drive/root/children?$select=sharepointIds
I would expect $select=*,sharepointIds to return both the default properties and the sharepointIds in the same response.
Is there another working way for the clients to request additional properties from Microsoft Graph without typing all of the property names in the object one by one including the default properties?
The underlying OneDrive API seems to handle select=*,[propertyName] correctly.
This isn't possible today. Microsoft Graph currently doesn't support wildcards in a $select query parameter. Each property you want to return must be explicitly listed in the $select.
I followed same steps that are mentioned in this question, to filter the push notification events based on custom properties set by outlook add-in.
Below is the resource link that I used while subscribing to push notifications.
https://outlook.office.com/api/v2.0/me/events/?$filter=SingleValueExtendedProperties%2FAny(ep%3A%20ep%2FPropertyId%20eq%20'String%20{00020329-0000-0000-C000-000000000046}%20Name%20cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c'%20and%20ep%2FValue%20ne%20null)
It's filtering the calendar items that are having custom properties set by add-in, irrespective of whatever custom property it is.
By looking at this resource link, we could say that no where we have mentioned the custom property name. But my add-in sets more than one custom properties to calendar item. I want to filter all calendar items that are having specific custom property. For example, My add-in sets any one of the below custom property to calendar based on business login.
Custom property 1:
var item = Office.context.mailbox.item;
item.loadCustomPropertiesAsync((result) => {
const props = result.value;
props.set("my_prop_one", "test_value_one");
props.saveAsync((saveResult) => console.log("Successfull"));
});
Custom property 2:
var item = Office.context.mailbox.item;
item.loadCustomPropertiesAsync((result) => {
const props = result.value;
props.set("my_prop_two", "test_value_tw");
props.saveAsync((saveResult) => console.log("Successful"));
});
Now I want to filter all calendar items that are having custom property my_prop_one.
EDIT 1:
As suggested by #Jason Johnston in one of the comments, I cross verified the property name and it's GUID using MFCMapi. Both property name and it's GUID values are correct.
MFCMapi data of custom property meetingsetby.
Then I collected data from MFCMapi and prepared the below url to filter calendar items that are having custom property meetingsetby and it's value webex.
https://outlook.office.com/api/v2.0/Me/Events?$filter=SingleValueExtendedProperties%2FAny(ep%3A%20ep%2FPropertyId%20eq%20'String%20{00020329-0000-0000-C000-000000000046}%20Name%20meetingsetby'%20and%20ep%2FValue%20eq%20'webex')
And below is the response from postman when I make the get call using above url.
As you can see, response has empty list even though there is one calendar item with custom property meetingsetby and value webex.
Then I set the SingleValueExtendedProperty to calendar item using outlook Rest API as described in this post. Below is the sample request data,
MFCMapi data of SingleValueExtendedProperty
Then I collected data from MFCMapi and prepared the below url to filter calendar items that are having singleValueExtendedProperty set in above step.
https://outlook.office.com/api/v2.0/Me/Events?$filter=SingleValueExtendedProperties%2FAny(ep%3A%20ep%2FPropertyId%20eq%20'String%20{6666AA44-4659-4830-9070-00047EC6AC6E}%20Name%20RestApiSingleValueExtendedProperty'%20and%20ep%2FValue%20eq%20'Set this property using REST API')
And below is the response from postman when I make the get call using above url.
As you can see, I can successfully filter the calendar items using singleValueExtendedProperty. But my requirement is filter calendar items that are having specific custom property set by my outlook web add-in.
Any suggestion/answers would be more than welcome.
Custom properties set by an add-in (using the CustomProperties interface) are not equivalent to normal MAPI named properties. Essentially what the add-in APIs do is take all of your "custom properties", serialize them as a JSON payload, then save it in a single MAPI named property, which will have the name cecp-{some guid}, and the property set GUID PS_PUBLIC_STRINGS {00020329-0000-0000-C000-000000000046}. The {some-guid} part of the name is equal to the Id of your add-in. This is all specified in MS-OXCEXT section 2.2.5.
So the end result here is that you cannot use $filter on the values you set in the CustomProperties interface, because there is no SingleValueExtendedProperty with that name and value. Instead, there is a single SingleValueExtendedProperty with the name cecp-{some guid}, with a string value that's the JSON serialization of ALL the custom props you set via the CustomProperties interface.
So how can you do what you want? Well, going back to your original URL, you can get all messages that have ANY properties set by your add-in by doing
$filter=SingleValueExtendedProperties/Any
(ep: ep/PropertyId eq 'String {00020329-0000-0000-C000-000000000046}
Name cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c' and ep/Value ne null)
Replacing the GUID after the cecp- with the GUID ID for your add-in.
But of course you want to find just the ones that have a specific property (meetingsetby) set to a specific value (webex). Unfortunately our API won't support substring searches when filtering the SingleValueExtendedProperties. So what you'd need to do is get all messages with any properties set by your add-in, then do your own filtering logic to find just the ones you want. So basically you would load them in memory, then check the value of that property yourself to find the ones you want.
You can make sure that the value of the property is included in the response by using an $expand clause. Something like this:
?$filter=SingleValueExtendedProperties/Any
(ep: ep/PropertyId eq 'String {00020329-0000-0000-C000-000000000046}
Name cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c' and ep/Value ne null)
&$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String
{00020329-0000-0000-C000-000000000046} Name cecp-7e248e5e-204e-4e2b-aa0f-788af20fc21c')
I'm trying to get values for PT_DOUBLE and PT_CLSID custom property data types using Microsoft Graph. I have no trouble getting custom properties for PT_LONG (Integer) or PT_UNICODE (String). Integer and String does not work for PT_DOUBLE and PT_CLSID properties, and I get this error:
ErrorInvalidExtendedProperty: The extended property attribute combination is invalid.
The documentation on supported data types is not very clear.
Here's a sample request that works for PT_UNICODE and PT_LONG props:
https://outlook.office.com/api/v2.0/me/contactfolders/{id}/contacts?
$top=1&
$expand=SingleValueExtendedProperties($filter=
(PropertyId eq 'String {1A417774-4779-47C1-9851-E42057495FCA} Name InlineLinks')+OR+
(PropertyId eq 'String {1A417774-4779-47C1-9851-E42057495FCA} Name XrmCompanyPeople')+OR+
(PropertyId eq 'Integer {1A417774-4779-47C1-9851-E42057495FCA} Name XrmContactType'))
I can live without PT_DOUBLE, but I really need to access these PT_CLSID props (String and Guid do not work):
XrmContactId: Tag = 0x86680048;
DASL: http://schemas.microsoft.com/mapi/string/{1A417774-4779-47C1-9851-E42057495FCA}/XrmContactId/0x00000048;
Kind: MNID_STRING
XrmId: Tag = 0x86680048;
DASL: http://schemas.microsoft.com/mapi/string/{1A417774-4779-47C1-9851-E42057495FCA}/XrmId/0x00000048;
Kind: MNID_STRING
Does anyone know the data type name for PT_CLSID or list of supported data types for Microsoft Graph? The Exchange Server Protocols Master Property List is painful to read through and it didn't give me any insights.
For SingleValueLegacyExtendedProperty, both the PropertyID and Value elements are strings.
One bit of clarification, the API you're calling here is the Outlook API and not Graph. While they provide similar functionality, they are distinct endpoints. Extended Properties in Graph also only supports string values.