I am writing an ASP.NET webapp together with some other students. We have to make it possible to schedule an appointment in outlook. So far we were able to create a .ics file with the dday iCalendar library. the user can download it and add it to outlook. is there a way to add the ics immediatly to the outlook calender withouth the user forcing to download it?
Yes, if the user is using IE and you site is added to the list of trusted sites. If these conditions are met, you can use the Outlook Object Model from your client side Java Script to create an instance of the Outlook.Application object using new ActiveXObject('Outlook.Application'). You can then call Application.CreateItem(1) (1 stands for the olAppointmentItem enum). Populate all the AppointmentItem properties and call AppointmentItem.Save.
Related
Is there a way where we could send E-Mail's via the Microsoft Interop Outlook Library by using the second mail like in this picture?
Whenever I tried sending E-Mails by the second folder, it uses the standard folder.
_Outlook.Folder folder = (_Outlook.Folder)outlookApp.ActiveExplorer().Session.Folders[1];
_Outlook.AppointmentItem agendaMeeting = (_Outlook.AppointmentItem)folder.Application.CreateItem(_Outlook.OlItemType.olAppointmentItem);
Firstly, do not hardcode the indices (e.g. Session.Folders[1]) - retrieve the stores by name.
If you already have MAPIFolder, call MAPIFolder.Items.Add instead of Application.CreateItem
You need to use the Items collections of the folder (Calendar folder in our case), not Application. The Add method accepts the OlItemType enumeration too and returns a newly created Outlook item.
_Outlook.AppointmentItem agendaMeeting = (_Outlook.AppointmentItem)folder.Application.CreateItem(_Outlook.OlItemType.olAppointmentItem);
Read more about possible ways of creating calendar items in the How To: Create a new Outlook Appointment item article.
I have a scenario where my Outlook Web App Add-in looks for the same email by subject in a database through API. If this email found in the database, I want to mark that email with some categorization so that user can visualize which emails have already been in the Database.
I am using the Office.js to get the subject and pass it to the API as through ajax call. The API written in C# looks into the database and return true or false.
if it returns true, I want to mark this email with category red from the code automatically.
Red category means follows.
Currently, there is no way of dynamically setting categories.
We track Outlook add-in feature requests on ourĀ user-voice page. Please add a feature request there. Feature requests on user-voice are considered when we go through our planning process.
I have a requirement to display a user's calendar entries for the next month on a web application dashboard view.
I have successfully used Exchange Web Services to achieve this following this documentation:
https://msdn.microsoft.com/en-us/library/office/dn495614(v=exchg.150).aspx
The final requirements for this task are that if the user clicks on the entry (in their browser):
Outlook should open on their machine and take them straight to the actual calendar entry.
I've inspected the appointment objects and I can see I have access to the calendar Id and I can easily pass this to the server however from here I'm a little confused how I can launch the application that is on their machine and tell it to open that entry Id.
Would this be another EWS call or Office.Interop.Outlook, is it even possible at all?
If this makes it anymore difficult, this is a .Net Core 2.0 web application.
Outlook still accepts command line switches, one of which let's you open an Outlook item, /select.
Now you just need to create a URL to launch Outlook with your command line arguments.
For IE, this is not too difficult assuming your web application is trusted:
javascript:(new ActiveXObject('Shell.Application')).ShellExecute('outlook.exe','/select outlook:<entryid>');
For Chrome, you could send a cmd file or create a helper exe that is downloaded, but the user would have to manually pick open to launch it.
Active X will not be working for all the modern browsers like chrome, IEEdge, firefox and safari. Alternatively you can create below registry entry and anchor link/button to open the outlook calendar
below is the markup
<button id="outlookCalendarBtn" onclick="window.open('outlookwebcal:')">
Open Outlook Calendar
</button>
Create below registry entry
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\outlookwebcal]
#="URL:Outlook Add Internet Calendar"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\outlookwebcal\shell]
#="open"
[HKEY_CLASSES_ROOT\outlookwebcal\shell\open]
[HKEY_CLASSES_ROOT\outlookwebcal\shell\open\command]
#="\"C:\\Program Files\\Microsoft Office\\root\\office16\\Outlook.exe\" /select outlook:calendar"
I am working on an outlook plugin. I want to give my manager reviewer permission to see my custom calendar (not the main Outlook Calendar) which I create programmatically.
My manager should be able to view my custom calendar programmatically.
I have given reviewer permission to my manager.
As of now, I don't know of any way where he can directly access my custom calendar programmatically. My custom calendar is at the same level as the main calendar.
A code like the following will not solve my purpose.
Outlook.Recipient oRecip = (Outlook.Recipient)oNS.CreateRecipient(userName);
Outlook.MAPIFolder usersCalendarFolder =
(Outlook.MAPIFolder) oNS.GetSharedDefaultFolder(oRecip,
Outlook.OlDefaultFolders.olFolderCalendar)
As this is to get my root calendar only.
And I dont want to give reviewer permission on my root folder. i.e. just "reviewer" permission on the custom calendar.
Do we have a way to achieve what I need?
Only Outlook's default folders for each item type can be accessed using GetSharedDefaultFolder. If you need to share any other folder that you've created manually, you'll have to share your entire Mailbox so that they can open it as an additional Mailbox in their Outlook profile or add it as a separate account.
In my current MVC project there is a requirement to open a new outlook mail item by clicking a button with pre populated body and subject.
I have used the following method to achieve that:
1. Create a MailItem with requried details like Subject, Mail body etc
2. Using SmtpDeliveryMethod as SpecifiedPickupDirectory and create an eml file
3. Force the user to download and open the file in outlook
So far so good and EML file is correctly opening in outlook but the user has to manually select his mail account from the "From dropdown".
My question is there any way to assign the detault From account in EML files in order to open in Outlook 2010
The way I got around it, and it is way "hacky" to say the least, is to open the saved .eml in C# and delete all the from/sender values before streaming it down to the browser.
I have an aspx page that accepts a bunch of querystring parameters that allow you to customize the .eml output. You can't save the .eml file without a "sender" or "from" email address, so you need to save that out first - I use a dummy email account. You can use the SMTP pickup method or the MailMessage extension class to save the .eml file. Then I open the saved file, look for my placeholder email address (in the "X-Sender" header and "From" values), replace that with an empty string, then send the altered stream to the browser. The user never gets the "from" dropdown, it just uses the default account. Works like a charm.