I used EWS API 2.0 to update the location and subject in an outlook meeting item. I can see both the location and subject reflects in the outlook calendar. However, when I pop open the appointment item, the location is blank, however, I can still see the updated subject.
Below is the code I used:
Appointment appointment = Appointment.Bind(_service, ConvertId(entryId));
appointment.Location = location;
appointment.Subject = "Server Update Subject";
appointment.Update(ConflictResolutionMode.AutoResolve, SendInvitationsOrCancellationsMode.SendToNone);
PS: I used outlook add-in (VSTO) to open my web application to find an available meeting room and update the meeting item.
As soon as the room (location) got updated on server side (via EWS), I can see the outlook calendar reflect the change immediately but the update does not show on the opened appointment item in outlook.
I need to close the appointment item in outlook and re-open the appointment item to see the update, but still, I can only see the updated subject, not location.
To see the updated location reflects there, I need to close Outlook and re-open it to see the location...
Any comments or direction for things to try will be great appreciated! Thank you :-)
Finally figured this out, after many hours of research.
It is a known issue that Outlook doesn't update the changes made through EWS (or change from the server side) until you re-open the application and release all references to the object (before re-opening). So the solution would be to add Marshal.ReleaseComObject as below:
Marshal.ReleaseComObject(apptItem);
to release the object (same as close outlook application), then re-open the object using EntryId.
string eid = item.EntryID;
--- release the app object ---
var ns = application.GetNamespace("MAPI");// application.Session;// application.GetNamespace("MAPI");
Outlook.AppointmentItem appoinment = ns.GetItemFromID(eid) as Outlook.AppointmentItem;
I hope this solution help anyone who ran into the same issue as I do.
Related
I have made a custom form region for my appointments in outlook - Which I really would like to use.
However, I have a problem with implementing it in my outlook.
When I want to schedule a new appointment, it opens up the correct form that I want to use - and works without any issues.
However, the problem occurs when I want to open and see my appointment. Here, it shows some previous published version - Which of cause does not properly work.
Things I have tried
I don't remember, that I at any time specified a default form to use upon opening an appointment. But the way it acts, it seems like I did.
I have tried deleting and republish my form with a different name
I have tried specifying "When posting to this folder, use" for my calendar
Still, it keeps opening already scheduled appointments with a completely different form, that I made several days ago.
Every Outlook item has the class name set, so that is how Outlook knows which form should be used to display the item. See Associate a form region with an Outlook message class for more information.
Also, you may take a look at the Assign a custom form to existing Outlook items article.
i am trying to develop an Outlook Addin which updates a web services whenevery the ser moves an appointment (with drag and drop) in his calendar.
In my VSTO based Outlook Addin (in Outlook 2016) my Item_Change gets fired when the user moves the calendar item around.
But when I inspect the AppointmentItem which I get as a parameter of the call to
public void Item_Change(Object item)
{
Outlook.AppointmentItem myAppointment = item as Outlook.AppointmentItem;
the myAppointment.StartUTC still shows the old value instead of the value (date/time) where the user has moved the item.
Does anyone know how to retrieve the new date/time of a moved AppointmentItem?
Thanks in advance
Not using the Outlook Objector Model - it likes caching old stale values. All items are affected, but appointments are the worst - sometimes you would also need to change the current folder and come back. You would need to release the item in question, open another item, and only then open this item by its entry id. The problem you cannot do that from the event handler of the item that raises the event.
Your only other options are Extended MAPI (C++ or Delphi only) or Redemption.
I'm developing an Outlook mail app using vs 2015. I want to show my add-in only when the existing calendar item is opened. When I have the FormType as ReadOrEdit in Rule Collection of manifest, the add-in shows for the appointment while creating itself. i.e. new appointment also has add-in. I don't want to show the add-in while creating a new appointment.
Is there any way to achieve this?
Change your FormType to Read. Then it will be shown only when you open existing one.
Changing FormType to Read doesn't help. Read works for meeting appointment created by other users. If the user is the Organizer of the appointment, add-in doesn't show.
I want to customize the appointment window used in Outlook. I want add few custom fields. I am using VSTO (VS2013) to develop this addin.
So far I have added a button in ribbon of appointment tab. On click of which I am opening a new form with custom fields. Now when user completes the form and other appointment details and appointment is saved then along with all appointment data, custom data entered by user should also get emailed to recipients.
And also that custom data would be stored in Exchange, and later that data can be queries to generate report.
So my question is - how do override the save appointment event so that I can add additional data in appointment and also how do I save it to exchange online using office 365.
Please advise.
Thanks.
When you are using an Exchange account which is the case with Office 365. The UserProperties of an Outlook item is kept in Exchange.
You can persist the custom data in UserProperties
If you want to Save your custom data when the appoitment is saved. You should put an event handler in the AfterWrite event. See AppointmentItem event list.
I have a small WinForms program that allows my users to create email blasts for our clients. The app has two options: one is an HTML editor to design the email (works great) and the second is to import .msg or .oft template.
Once the email is complete it is moved to a shared outlook mailing folder for a nightly macro send job.
Pretty simple stuff!
The problem: Once the template is open in the application outlook seems cache that version. If the user decided to get out make a change in the template Outlook doesn't pick up the update.
Note: If the users clicks on the "Preview" button they received the correct UPDATED version in their inbox. But when they submit the MailItem it picks up the old version.
Dim newItem as Outlook.MailItem = gobjOutlook.CreateItemFromTemplate(fileEmailTemplate.FileName)
The send command works fine newItem.Send()
But when I move it to the shared folder it gets the original version from somewhere.
Dim addFldr As Outlook.MAPIFolder
addFldr = StoreFLDR.Folders.Add(gobjNamespace.CurrentUser.Name & ": " & DateTime.Now.ToString())
newItem.Save()
newItem.Move(addFldr )
I have tried forcing the GC and SaveAs to another location and reload the template, no luck.
I'd suggest starting from releasing underlying COM objects instantly. Use System.Runtime.InteropServices.Marshal.ReleaseComObject to release an Outlook object when you have finished using it. Then set a variable to Nothing in Visual Basic (null in C#) to release the reference to the object.
You may find the How To: Create a new Outlook message based on a template article helpful. Anyway, it would be great to see your full source code related to Outlook.