Using Microsoft's EWS to create online Lync/Skype meeting - c#

Anybody knows how to create meeting request with online conference(Lync/Skype) using EWS?
So my approach is first getting an online and regular meeting created via Outlook and then simulate the creation of event with the same property.
Here is my code snippet for getting the meeting (calendarView is already initialized with start date, end date etc.):
ExtendedPropertyDefinition extendedOnlineMeetingProperty =
new ExtendedPropertyDefinition(new Guid("{00062008-0000-0000-c000-000000000046}"), 34112,
MapiPropertyType.Integer);
var properties = new PropertySet(
ItemSchema.Id,
AppointmentSchema.ICalUid,
ItemSchema.Subject,
AppointmentSchema.Start,
AppointmentSchema.End,
AppointmentSchema.Organizer,
AppointmentSchema.Location,
AppointmentSchema.LegacyFreeBusyStatus,
AppointmentSchema.IsCancelled,
AppointmentSchema.ICalRecurrenceId,
AppointmentSchema.MyResponseType, // Mandatory Meeting.MyResponseType can be retrieved without a search in the participant list
ItemSchema.LastModifiedTime,
AppointmentSchema.IsOnlineMeeting,
AppointmentSchema.IsMeeting,
ItemSchema.DisplayTo) { };
properties.Add(extendedOnlineMeetingProperty);
var activeResults = service.FindAppointments(WellKnownFolderName.Calendar, calendarView).ToList();
if (activeResults.Count > 0)
{
service.LoadPropertiesForItems(activeResults, properties);
}
I got the property IsOnlineMeeting with the correct bool value (tested -
created online and regular meeting with Outlook) in variable activeResults but I do not understand where to get conference link and other Lync/Skype properties needed for joining a conference.
Also I am not sure where and how to assign the values of Lync/Skype conference URL and other properties.
Sometimes I ask myself if it's worth it to developed some app based on MS products since their documentation suck.

After one week of cursing MS I have found a solution. Using the tool MFCMAPI you can check what property and their values your item in mailbox have.
download the program link
build and run it
Session - Logon - choose your mail profile - pick the mailbox and double click
actions - open special folder - calendar - double click on calendar
open the item with online S4B/Lync conference
the UC* properties are the one I was looking for.
If you open the property you can see something like this on the top:
ag: 0x8096001E
Type: PT_STRING8
DASL: http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/UCMeetingSetting
Named Prop Name: UCMeetingSetting
Named Prop Guid: {00020329-0000-0000-C000-000000000046} = PS_PUBLIC_STRINGS
So my definition of the extended property was wrong. It is not only one property but actually you need all 7 of them.
So the definition should be:
private static ExtendedPropertyDefinition CreateOnlineMeetingProperty()
{
ExtendedPropertyDefinition extendedUCMeetingSetting =
new ExtendedPropertyDefinition(new Guid("{00020329-0000-0000-C000-000000000046}"), "UCMeetingSetting",
MapiPropertyType.String);
return extendedUCMeetingSetting;
}
With the correct extended definition you can get the values from the item easily.
accessing the Value of ExtendedProperties
Calling TryGetProperty
var activeResults = service.FindAppointments(new
FolderId(WellKnownFolderName.Calendar, resource.Email),calendarView).ToList();
service.LoadPropertiesForItems(activeResults, properties);
foreach (Appointment result in activeResults)
{
// 1.
var b = result.ExtendedProperties[1].Value;
// 2.
string UCMeetingSetting;
result.TryGetProperty(extendedUCMeetingSetting, out UCMeetingSetting);
}
using steps above you can get whatever extended property you want, not only Unified Communications (UC) properties.

Ok, I managed to have this working (almost!) by setting just one of the extended properties:
appointment.SetExtendedProperty(
new ExtendedPropertyDefinition(
new Guid("00020329-0000-0000-C000-000000000046"),
"OnlineMeetingExternalLink",
MapiPropertyType.String
),
skypeMeeting.JoinUrl
);
I say almost because the appointment doesn't look exactly like a Skype meeting when you open it in Outlook: doesn't have the footer will the Join link and phone number etc.
Maybe there are other differences, but for now we see it in Skype for business with the Join button and also we see the it in the Outlook reminder with the Join button.
As a workaround, we have to hard-code the body content of the appointment.
Also conference ID, can be taken using UCWA 2.0 (https://learn.microsoft.com/en-us/skype-sdk/ucwa/myonlinemeetings_ref)
We used UCWA 2.0 to create the Skype conference call and attached it to the EWS appointment object.

Related

TFS 2018 API: Can access workitems but not workitem API end point

I created a middleware app that will pull work item data from TFS.
I was able to do this using the workitems end point.
http://sampleserver:8080/tfs/sampleproject/_apis/wit/wiql?api-version=4.0/workitems?ids=1,2,3
Now, I also need to get the work item links per work item. Per docu I would need to access the workitem with expand items. But unfortunately, work item end point does not seem to work.
http://sampleserver:8080/tfs/sampleproject/_apis/wit/wiql?api-version=4.0/workitem/3
Am I missing something here?
According to your description, looks like you just want the URL of created WorkItem, so that anyone when click on URL, created Work Item will be Open.
https://tfsurl:8080/tfs/DefaultCollection/PatrickProject/_workitems/edit/172/
The URL should be above format and here DefaultCollection is the collection name and the PatrickProject is the project name. I used this url and got rid of the id '172' in this case and use the ID of newly created work item. This would return the URL to go to the work item HTML page.
So it's a fixed format, if you have Newly Created WorkItem ID and collection name , project name, you just need to follow above format and change the last value of work item ID. That's it , ignore of which work item type you created.
If you want do this with code, do not use Rest API, you need to use client API, sample snippet:
var tfsURI = new Uri("http://test:8080/tfs");
var networkCredential1 = new NetworkCredential("test", "test!");
ICredentials credential = (ICredentials)networkCredential1;
Microsoft.VisualStudio.Services.Common.WindowsCredential winCred = new Microsoft.VisualStudio.Services.Common.WindowsCredential(credential);
VssCredentials vssCredentials = new VssCredentials(winCred);
using (TfsTeamProjectCollection collection = new TfsTeamProjectCollection(tfsURI, vssCredentials))
{
collection.EnsureAuthenticated();
TswaClientHyperlinkService hyperlinkService =
collection.GetService<TswaClientHyperlinkService>();
String TFSurl = hyperlinkService.GetWorkItemEditorUrl(17648).ToString(); //17648 WorkItem ID
}
Hope this Helps!
To get specific work item information you need to use the Get Workitem API call so try http://sampleserver:8080/tfs/sampleproject/_apis/wit/workitems/3?api-version=4.0 instead.
You can also use this http://sampleserver:8080/tfs/sampleproject/_apis/wit/workitems/3?$expand=Links&api-version=4.0 and this will return the work with Id of 3 and all it's links (parent, attached files, changetset, etc.)
Notice that the api-version=4.0 with change depending on the version of TFS/Service you are using and should always be the last string in the REST call.

Creating appointments on other calendars, shared with me, using EWS API

I hope this is the right forum to ask this question.
My requirement is as mentioned below:
-> I need to create an appointment on my Default calendar and the same on other calendars that are shared with me (or created by me and shared with others) by using Exchange Services (EWS).
-> By shared, i mean all those calendars that I can see under my 'Other Calendars' group in Office 365.
-> Now, I have reffered many links which help to create appointments on my mailbox, default Calendar. This part works fine(Link : (http://technico.qnownow.com/how-to-create-appointment-using-ews-exchange-web-services/)
-> Then I moved on to access shared calendars so that I can create the same appointment on them.
Used this : EWS - Access All Shared Calendars
-> However I do not get the PidTagWlinkAddressBookEID property in any of the items fetched.
The code works fine till I get the fiResults collection.
I get names of all the calendars under Other Calendars section in this collection.
The problem is when I iterate over this collection (as you can see in the code) , i am trying to get the PidTagWlinkAddressBookEID property value in each item and its not present in the item.
And this is the reason I am not able to retrieve the FolderID at the end.
But i tried number of ways to do it since i get the collection of items and I can see my shared calendars' names in those items.
Since i created the shared calendars, I tried to use my mailbox address at the end in this part of the code :
FolderId SharedCalendarId = new FolderId(WellKnownFolderName.Calendar, ncCol[0].Mailbox.Address);
However the calendar retrieved in this case is the default calendar with displayName as Calendar.
Since each item in the itemcollection ( fiResults collection) represents the corresponding shared calendar
Please let me know if we can use any property in the Item class to create an appointment.
I tried one more approach to create appointments on shared calendars:
First i tried to access all the calendar folders by using:
private void ViewCalendarFolders(string mailBox)
{
ExtendedPropertyDefinition PR_Folder_Path = new ExtendedPropertyDefinition(26293, MapiPropertyType.String);
PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
psPropSet.Add(PR_Folder_Path);
FolderId rfRootFolderid = new FolderId(WellKnownFolderName.Root, mailBox);
FolderView fvFolderView = new FolderView(1000);
fvFolderView.Traversal = FolderTraversal.Deep;
fvFolderView.PropertySet = psPropSet;
SearchFilter sfSearchFilter = new SearchFilter.IsEqualTo(FolderSchema.FolderClass, "IPF.Appointment");
FindFoldersResults ffoldres = exchangeService.FindFolders(rfRootFolderid, sfSearchFilter, fvFolderView);
var res = ffoldres.Where(f => f is CalendarFolder).ToList();
if (res.Any())
{
foreach (Folder fld in res)
{
Console.WriteLine(fld.DisplayName);
}
}
}
Then I tried to create appointments on the CalendarFolders fetched.
I succeeded in creating appointments on two calendars:
1) My default calendar
2) The calendar which I have created and shared with others.
the piece of code shown above fetches all the calendar folders except those which are created by other users and shared with me. (Even though I can see them under the Other Calendars section in office 365 and can even create appointments on them through UI i.e. manually)
Kindly let me know how to create appointments on such calendars which are shared by others with me.
Note: I have Editor rights on these type of calendars
Thanks

Exchange API incorrect Subject

When ever I create a meeting in Outlook, Subject field for an appointment is going through incorrectly. Instead of something like "Test" I get the name of the user who created an appointment.
-> bold = title, admin = creator name
-> admin = creator name even though it suppose to be subject.
foreach (Appointment a in room.appointments)
m.Subject = a.Subject
Is this a known issue; Is there another field that is responsible for subject?
This is actually not an "issue" but a "feature" of Exchange's workflow for meeting invites. The default on a room resource is to replace the subject with the orgranizer. This can be changed for a room with a PowerShell command:
Set-Calendarprocessing -Identity:roommb -AddOrganizerToSubject:$false -DeleteSubject:$false
Of course you need proper permissions to do this, or else bribe your Exchange admin!

Access Public String MAPI Properties through EWS

I've created custom properties in an Appointment in Outlook through JavaScript in an App for Outlook, which have saved successfully. I have checked the MAPI properties of this appointment and I can see the property as a JSON dictionary.
MFCMAPI display of the stored property:
I'm now trying to retrieve this through EWS in a C# application. For troubleshooting purposes, I also attempt to retrieve another property, with the ID of 33336.
ExtendedPropertyDefinition epd = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "cecp-propertyNames", MapiPropertyType.String);
ExtendedPropertyDefinition epd2 = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Appointment, 33336, MapiPropertyType.String);
//Create our sync window. This is the period of appointments it will capture and sync
CalendarView cv = new CalendarView(START_DATE_SYNC, END_DATE_SYNC);
cv.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, epd, epd2);
FolderId calendarFolderId = new FolderId(WellKnownFolderName.Calendar, room.Address);
FindItemsResults<Appointment> fappts = service.FindAppointments(calendarFolderId, cv);
Exchange returns the appropriate appointment items, but when accessing the extended properties, only the property with the ID of 33336 (the test one) is returned. Any time I try and retrieve a PS_PUBLIC_STRINGS item, nothing comes back.
Your imgur link is frustratingly cropped. I cannot see the named property guid column to check if it matches what you're trying there in the EWS code. So I can only guess that I think you've got the wrong property set.
Have you tried looking at the item with EWS Editor to see if it finds the property you're looking for naturally? If it does, you can read off the details you need to construct your EWS code.

Create a meeting using Windows Live REST API

I'm trying to create a meeting on Outlook.com using the Windows Live REST API (for Windows Phone 8).
I'm able to create a calendar entry with all the basic fields of event object (http://msdn.microsoft.com/en-us/library/hh243648.aspx#event), but I can't find a way to add the organizer and the attendees to the event.
There is a way to make that, using any key not specified for the event structure?
For example I saw that in the contact object can contains a user object, even if not specified into the structure (it is written under the table).
This is the structure I used for now: it works, maybe could be usefull for someone else (as I said, it is missing of organizer and attendees):
IDictionary<string, object> appointment = new Dictionary<string, object>();
appointment.Add("name", "event");
appointment.Add("description", "a meeting");
appointment.Add("start_time", "2014-11-19T23:37:00+01:00");
appointment.Add("end_time", "2014-11-27T02:37:00+01:00");
appointment.Add("location", "somewhere");
appointment.Add("is_all_day_event", false);
appointment.Add("reminder_time", 15); //minutes
appointment.Add("availability", "free");
appointment.Add("visibility", "public");

Categories