问题
When a user has created an event in outlook.com shared calendar, the REST API tells that calendar owner is organizer.
I have one calendar in Outlook.com and I'm syncing all calendar event's to my server with a calendar subscription. I get notifications when something happens and there is url in the notification which I can use to get object of that newly created event.
I have now another user in outlook.com and I have shared my calendar to him. When he does something in that shared calendar I get notifications, but I don't get any information about who created new event.
Organizer is always my user and for some reason in the event object name is fine, but email address is something like outlook-[nonsense]@outlook.com
(that's not my email address). My real email address is more like lehtu@outlook.com
.
See this image for clarification:
The organizer part of the response:
Organizer:
{ EmailAddress:
{ Name: 'Encode Testing',
Address: 'outlook_2FD8F7EE77CEC8B8@outlook.com' } },
Application auth is made only with my user(which name is Testing in the picture).
Here is my credential:
this.scopes = [
'openid',
'offline_access',
'https://outlook.office.com/calendars.readwrite'
];
Point is to have more calendars under my account and I will share them to others. But I must get the info into my app that who is creating events.
Any ideas?
回答1:
It is expected that the organizer of events on a shared calendar is always the owner of said calendar. Essentially Testing2 has created the event on Testing's behalf, but Testing2 does not become the organizer. The odd email address you are seeing for Testing is his underlying outlook.com email, which is added since you're using a custom domain.
Unfortunately today it doesn't seem like the API directly exposes information regarding who actually created an event. This is probably a good feature to suggest on UserVoice. However, you might be able to access it indirectly.
Whenever the API doesn't directly expose a property, you can look at the underlying properties exposed by Exchange server. I usually look them up in the MS-OXPROPS doc. I found PidTagCreatorName, which looks like it might help get the data you're after.
You can usually access these underlying properties by expanding (via $expand
) the SingleValueExtendedProperties
collection on items. So if you do a GET on the following:
https://outlook.office.com/api/v2.0/me/events?
$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x3FF8')
You'll see results returned that look something like:
{
...
All the normal props you usually see
...
"SingleValueExtendedProperties": [
{
"PropertyId": "String 0x3ff8",
"Value": "Jason Johnston"
}
]
}
来源:https://stackoverflow.com/questions/39089878/outlook-com-rest-api-incorrect-organizer-email