outlook - Flagged messages via Office 365 REST API? -
i'm looking way detect & set 'flagged' status of email using office 365 rest message api. don't see 'flag' listed property of rest message, though see listed under exchange web services.
i've attempted make rest call adding flag filtered properties, singlevalueextendedproperties , multivalueextendedproperties like:
/folders/inbox/messages?$top=50&$select=subject,...,flag /folders/inbox/messages?$top=50&$select=subject,...,singlevalueextendedproperties /folders/inbox/messages?$top=50&$select=subject,...,multivalueextendedproperties
all of these have come form of:
{"error":{"code":"requestbroker-parseuri","message":"could not find property named \\\'flag\\\' on type \\\'microsoft.outlookservices.message\\\'."}}
any suggestions on how access outlook 'flag' property via rest api?
update: there flag
property on message
on /beta
endpoint. recommended way this. i'll leave other information there historical purposes , folks trying set other extended properties.
now can get/set flag status easier. message
entity has flag
property of type followupflag
. (if don't see @ link, sure beta
version selected @ top of page).
you can mark message flagged sending patch
following payload:
{ "flag": { "flagstatus": "flagged" } }
old method (using extended properties)
note: made change simplify extended properties format. change rolling out servers now, i've added new format answer. i've left old format in case accessing mailboxes haven't had update applied yet. if using old format , error:
"could not find property named 'propertyref' on type 'microsoft.outlookservices.singlevaluelegacyextendedproperty'."
you need move new format.
what need include $expand
query parameter expand singlevalueextendedproperties
collection, $filter
sub-parameter indicate property want include. in case, want pidtagflagstatus. try query this:
new format:
api/beta/me/messages?$select=subject,singlevalueextendedproperties&$expand=singlevalueextendedproperties($filter=propertyid eq 'integer 0x1090')
old format:
api/beta/me/messages?$select=subject,singlevalueextendedproperties&$expand=singlevalueextendedproperties($filter=(propertyref eq '0x1090' , type eq microsoft.outlookservices.mapipropertytype'integer'))
messages aren't flagged @ not have property returned. messages this:
new format:
{ "@odata.id": "https://outlook.office365.com/api/beta/users('jasonj@jasonjohdemo.onmicrosoft.com')/messages('aamkagq4yzc2ndkwltyxymitndzmys1izji1ltyynmy4ntzkmji1ngbgaaaaaadwpsus7ewar6q1wntgoqembwdpfbfj8uputqu4bewgpnfmaaaaaaegaadpfbfj8uputqu4bewgpnfmaaajcujgaaa=')", "@odata.etag": "w/\"cqaaabyaaadpfbfj8uputqu4bewgpnfmaaajcznd\"", "id": "aamkagq4yzc2ndkwltyxymitndzmys1izji1ltyynmy4ntzkmji1ngbgaaaaaadwpsus7ewar6q1wntgoqembwdpfbfj8uputqu4bewgpnfmaaaaaaegaadpfbfj8uputqu4bewgpnfmaaajcujgaaa=", "subject": "test flag", "singlevalueextendedproperties@odata.context": "https://outlook.office365.com/api/beta/$metadata#me/messages('aamkagq4yzc2ndkwltyxymitndzmys1izji1ltyynmy4ntzkmji1ngbgaaaaaadwpsus7ewar6q1wntgoqembwdpfbfj8uputqu4bewgpnfmaaaaaaegaadpfbfj8uputqu4bewgpnfmaaajcujgaaa%3d')/singlevalueextendedproperties", "singlevalueextendedproperties": [ { "propertyid": "integer 0x1090", "value": "2" } ] }
old format:
{ "@odata.id": "https://outlook.office365.com/api/beta/users('jasonj@jasonjohdemo.onmicrosoft.com')/messages('aamkagq4yzc2ndkwltyxymitndzmys1izji1ltyynmy4ntzkmji1ngbgaaaaaadwpsus7ewar6q1wntgoqembwdpfbfj8uputqu4bewgpnfmaaaaaaegaadpfbfj8uputqu4bewgpnfmaaajcujgaaa=')", "@odata.etag": "w/\"cqaaabyaaadpfbfj8uputqu4bewgpnfmaaajcznd\"", "id": "aamkagq4yzc2ndkwltyxymitndzmys1izji1ltyynmy4ntzkmji1ngbgaaaaaadwpsus7ewar6q1wntgoqembwdpfbfj8uputqu4bewgpnfmaaaaaaegaadpfbfj8uputqu4bewgpnfmaaajcujgaaa=", "subject": "test flag", "singlevalueextendedproperties@odata.context": "https://outlook.office365.com/api/beta/$metadata#me/messages('aamkagq4yzc2ndkwltyxymitndzmys1izji1ltyynmy4ntzkmji1ngbgaaaaaadwpsus7ewar6q1wntgoqembwdpfbfj8uputqu4bewgpnfmaaaaaaegaadpfbfj8uputqu4bewgpnfmaaajcujgaaa%3d')/singlevalueextendedproperties", "singlevalueextendedproperties": [ { "propertyref": "0x1090", "type": "integer", "value": "2" } ] }
setting flag simple sending patch message property in singlevalueextendedproperties
collection:
new format:
patch https://outlook.office365.com/api/beta/me/messages/{id} { "singlevalueextendedproperties": [ { "propertyid": "integer 0x1090", "value": "2" } ] }
old format:
patch https://outlook.office365.com/api/beta/me/messages/{id} { "singlevalueextendedproperties": [ { "propertyref": "0x1090", "type": "integer", "value": "2" } ] }
finally, per ms-oxoflag, value of 2 means flagged follow up, , 1 means flag completed.
Comments
Post a Comment