Possible ways to optimize batch Outlook appointment processing with MAPITable - outlook

I'm working in a component that syncs our own appointment data with the ones in a selected calendar folder in Outlook.
The first time when our appointments sync to Outlook, the ID of our appointment is stored in the user properties of the newly created Outlook appointment.
Therefore, before syncing each appointment to Outlook, our code has to check if there is already an appointment in Outlook that has their ID. The code is currently looping through the Folder.Items collection and look into the UserProperties of each one of them, this is obviously very slow.
I found this stackoverflow question, which suggests that I can query the MAPITable to filter out appointments that has no user properties first.
However, as more and more appointments are synced to Outlook overtime, the filtered result would become pretty big too.
Does anybody know if there is any faster way to go through user properties of all appointments in an Outlook folde?

I had a similar problem of filtering Appointments using a UserProperty say 'MyUserProperty' of olText type. I used a DASL query which filtered the Folder Items using UserProperty.
string myPropertyValue = "SomeID";
filter = "#SQL=\"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/MyUserProperty/0x0000001F\" = '" + myPropertyValue + "' ";
filteredAppointment = myFolderItems.Find(filter);
MSDN Documentation : Filtering a Custom Field

Use the Find/FindNext or Restrict methods of the Items class instead of integrating over all items in the folder.
Take a look at the following articles which illustrate how to use them:
How To: Retrieve Outlook calendar items using Find and FindNext methods
How To: Use Restrict method in Outlook to get calendar items

Related

Get unique ID before saving the meeting in Outlook that must be same after saving the meeting

I'm working on Outlook add-in, In which we are providing the service for ordering the catering products during the meeting scheduling.
I want to send the order along with the meeting (for which meeting i ordered the products) so in this case i need any id i.e MeetingId So can save this meetingId and order detail in the database.
When i will open scheduled meeting from my Outlook calendar and on the behalf of that meetingId i can get the order detail from the server and i can update the order.
So i'm looking any solution, Please share your suggestion here how can i update my order inside the Add-ins from already scheduled meeting.
On the compose form you may call the Office.context.mailbox.item.saveAsync method and then get the itemId property value. There is no need to call the saveAsync method if the appointment was saved previously.

How to programmatically set the subject (title) of an Outlook 365 meeting from user data entered at runtime

Background
Our Training team uses an Excel worksheet to track our online training, listing the date, customer, topic, type of training, type of meeting (Teams live event or Teams meeting), presenter, and moderator. In addition to the information in the worksheet, we create an Outlook 365 meeting for each workshop. The subject (title) of the Outlook meeting takes this format: {Customer} {Topic} {Event Type} {Meeting Type} {Start}.
Goals
Replace the Excel worksheet with an Outlook 365 view in table
layout, eliminating a time-consuming and redundant step in our process.
Minimize data entry.
Do 1 and 2 in such a way that I can distribute the solution to our Training team without involving a request to systems admins or requiring our team to do any heavy lifting code- or configuration-wise.
Problem
I've tried two methods and am getting stuck at the same spot: I can't figure out how to set the meeting request subject equal to the information entered by the user.
Progress
Method 1: Outlook form or template
I modified P.2 in an appointment request in Outlook 365 to be a data entry form for the custom fields Customer, Topic, EventType, MeetingType, Presenter, and Moderator. Another custom field, TrainingEvent, is a read-only Boolean set to Yes when the appointment is created. I use this field to filter non-training events out of the new calendar view. Another custom field, EventID, has an initial value that concatenates the other fields in the order we need for the meeting subject. I saved the modified request as both a form and an Outlook template to test each method.
Both work fine, right up to the point of setting the actual meeting subject equal to the EventID. That is, when I submit the request the meeting is created and all the fields are populated with what I entered. The subject remains empty. I can't find any guidance, using VBA or otherwise, on how to populate the subject based on user entry at runtime.
Method 2: Microsoft Forms + Automate
So I tried another way: I created a form in Microsoft Forms to collect the same data, then ran it through Microsoft Automate modifying an existing template that creates an Outlook 365 event when a form is submitted. Same result: The event is created with all my entered data, but the subject remains empty.
Obviously, I could just ask our team to enter all the separate fields and also the subject, but that defeats goal #2.
What am I missing? This feels like it should be such an easy problem to solve.
I found the answer. I added the Subject field to my custom P.2 (data entry form). In the field properties on the Value tab, I changed "Property to use" from Value to Text and set the initial value to the concatenated field EventID. Voila!

Item.Id.UniqueId is not unique

We have a service which syncs our calender with an exhange calender. In the synchronisation process we use the unique ids to identify the appointments. Now we have a customer, which has non-unique UniqueIds.
I used the EwsEditor (https://github.com/dseph/EwsEditor) to inspect the elements and yes, both appointments (same user, same month, same UniqueId, but a different appointment) have exact the same UniqueId.
Both appointments are not created with our software. They are manually created by the user via Outlook.
Is there a reason why the exchange creates appointments/meetings with the same Ids?
Are you saying that an Id has been reused (if so that's possible as it will still be unique). Or are you saying that you have two id's in the same calendar that are the same if so are you sure your not confusing recurring appointments or that fact that the UnqiueId's are base64 encoded so this means the Id's are case sensitive.
That said using the UniqueId for calendar appointment isn't a great idea and you would be better using the GOID property like PidLidCleanGlobalObjectId https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidlidcleanglobalobjectid-canonical-property

How to find Outlook contact Unique ID?

I want to see all fields of the contacts in outlook. Here the contacts are synchronized from D365. All fields that are coming from D365 will also be shown in outlook contacts (fields such as PrimaryId, CreatedBy, Owner, CreatedDate, modified By, modifiedDate etc.. )
When I open the contacts, not all fields are showing. How can I see all fields of the records?
Suggestions are appreciated.
You can open Advanced Find for Contacts and in there you can select additional columns.
Thanks Naveen. Except for ContactId, all the fields that you list should be available in a Contact Advanced Find view.
To get the ContactId for an individual record, you can get it from the URL of the record, or use the Chrome Level Up add-in, or bookmarklets.
To get a list of Contact ID's you can export a view to Excel with reimport to get the ID's in the hidden column A, or create a FetchXML query and run it in FetchXML Tester, among other ways.
In Outlook client for CRM, follow these steps to view the fields.
The EntryID is the unique identifier for each mail object in the user’s mailbox. This value is also used in the idMappingTable to relate the CRMID to the appropriate Outlook EntryID.
crmEntryID (*) corresponds to the Outlook EntryID of the object
Crmid corresponds to the created record’s unique GUID in CRM
Read more.

google calendar api: calendars vs calendarList

I was messing around trying to add a new calendar and it took me quite a while to figure out that I had to add it to 'Calendars' and not to 'CalendarList'. It works now, which is nice, but I what is the difference between the two concepts? It seems to me I only need Calendars? Also, CalendarList doesn't seem to work, trying to insert a Calendar returned a 404 error.
Calendars is a collection of all calendars in the world (it does not have a list method). When creating a new calendar, you should call an insert on the calendars collection. When you want calendar specific data (such as the timezone, the name) then you should retrieve a calendar from calendars collection using get.
CalendarLists is a collection of all calendar entries that a user added to their list (in the web UI it's the list of calendars in the left panel). You cannot create a new calendar through the calendar list collection but you can add an existing calendar to the list of your users calendars. Each user can for example have a different color for the same calendar and this detail will be stored in the calendar list entries.
What is sometimes confusing is that when you create a new calendar through calendars collection, it will be automatically added to your list.
Let me give you an example of how Calendars and CalendarLists work. Imagine your friend creates a calendar for a trip that you will be going on together. He does so by doing a Calendars.insert() call.
Now he makes the calendar public (via ACLs collection) and sends you and all the friends an email of this calendar. You can go into the CalendarLists collection and do an insert() call there to add it into your list of calendars and make it blue.
Calendars:
The Calendars collection represents all existing calendars. It can be
used to create and delete calendars. You can also retrieve or set
global properties shared across all users with access to a calendar.
For example, a calendar's title and default time zone are global
properties.
CalendarList:
The CalendarList is a collection of all calendar entries that a user
has added to their list (shown in the left panel of the web UI). You
can use it to add and remove existing calendars to/from the users’
list. You also use it to retrieve and set the values of user-specific
calendar properties, such as default reminders. Another example is
foreground color, since different users can have different colors set
for the same calendar.
Here the comparison table:
https://developers.google.com/google-apps/calendar/concepts/events-calendars

Resources