|
Third party IM integration with outlook
x64 outlook2016 and CoCreateInstance error 0x80040155 on win10
There is a document How to: Check the Version of Outlook https://msdn.microsoft.com/en-us/library/office/dd941331(v=office.15).aspx#
it gives componentId for outlook2010,outlook2013, what is the id for outlook2016? Where I can find the ID for outlook2016?
Also I found office 2016 automation can not work well on x64 win10. The following code will create outlook process instance, the code work fine with both 32bit and 64bit outlook2010,outlook2013 on win7/win8.
CComPtr<outlook::_application>spApp;
hr = spApp.CoCreateInstance(__uuidof(Outlook::Application), NULL, CLSCTX_LOCAL_SERVER);
The code works fine with both x32/x64 outlook2016 on win7,the code works fine too with 32 bit outlook2016 on x64 win10 too, but the code will get error hr=0x80040155 with 64 bit outlook2016 on win10, uninstall/reinstall x64 office2016 won’t fix the problem. Could it be a Win10 compatible issue with x64 outlook automation?
Thanks in advance.
Problem with Filter property on Outlook's AutoFormattingRule object (2)
NOTE: This thread is a continuation of the following thread (which broke -- not possible to post to it anymore):
https://social.msdn.microsoft.com/Forums/office/en-US/881da0dc-40ff-4d81-9920-429a74035472/problem-with-filter-property-on-outlooks-autoformattingrule-object?forum=outlookdev
Hi Eugene,
My project is using Javascript.
I tried the VBA routine you proposed and find that it reproduces the problem I am having.
After I executed the routine, initially no items in my folder are formatted/underlined. If I check the settings of the view, I can see the custom conditional formatting rule that was added by the script, but I can also see that the filter/condition looks blank. If I navigate away from the folder and back, the conditional formatting is applied to ALL items (all items become underlined), which indicates 1) that it is necessary to perform some additional action for the rule to take effect, and 2) that the filter is not working.
Do you see a different behavior when running the routine in your Outlook?
Thanks,
Mats
PS. Sorry for starting a new thread for this issue, but the page of the original thread is broken -- some javascript error prevents me from posting replies on that page.
Outlook Billing Information
I wish to use the 'Billing Information' field to store a reference value with an e-mail that will allow me to associate this particular e-mail with an entity in the system (more specifically an Estate in a Deceased Estate Management system) when I scan the 'SentMail' folder after sending (a customer request). I do the following (note that also tried the 'Mileage' field):
mailItem = DirectCast(clsobjOutLook.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
attAttachments = mailItem.Attachments
attAttachments.Add(pstrSourceFile, Outlook.OlAttachmentType.olByValue, 1, clsstrInputDoc)
mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
mailItem.To = ""
mailItem.Importance = Outlook.OlImportance.olImportanceHigh
mailItem.ReadReceiptRequested = True
mailItem.BillingInformation = clsstrEstRefNo
mailItem.Mileage = clsstrEstRefNo
mailItem.Display(True)
'
objSentFolder = clsobjOutLook.Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail)
sentItems = objSentFolder.Items
folderItem = sentItems.GetFirst
While folderItem IsNot Nothing
sentItem = TryCast(folderItem, Outlook.MailItem)
If sentItem IsNot Nothing Then
If sentItem.BillingInformation = clsstrEstRefNo OrElse sentItem.Mileage = clsstrEstRefNo Then
strTest += vbCrLf & sentItem.Subject 'This is just for development!!!
End If
End If
folderItem = sentItems.GetNext
End While
strTest = "Estate Mail: " & strTest
MsgBox(strTest)
The e-mail is sent successfully but neither the Billing nor Mileage seems to go through. The folder scanning works, but I cannot retrieve the fields.
Any ideas?
Regards,
Axel Trunk
Create and send email from table which each row is one person email address
I have a table which each row is one person email
what I want is from this table create an email for each row by adding the subject, detail info and others.
Email Address | Subject | Detail info | Others |
x@microsft.com | Meeting | Here is the detail | Come early |
g@gmail.com | Discussions | The discussion topic is…. | Be prepared |
Y@yahoo.com | Vacations | Your vacations are approved | Enjoy your vacation |
as you see we have 3 rows and the first columns is the email address.
My question now is, who I can create from this table an email for each row. (send email separately for each one of from row list)
- The email address goes to email TO:
- The subject Columns goes to Subject:
- Detail Info and Others going to the body of the email
Addin Event BeforeItemMove gets deleted by EWS or OWA Move Operation
Hi,
I want to disallow users to move or delete emails from their inbox. Currently I use a .NET addin which sets the "BeforeItemMove" event for the affected folders and always sets "Cancel = true;" and it is working fine.
All users are able to move emails with a custom button. Since the moving should be done by another user account with more rights,I use the "Microsoft.Exchange.Webservices" EWS API to create a second connection to Exchange with a different user and to move the email. This is also working fine. (I convert the EntryID to EwsID)
After the inbox email has been moved to a subfolder via Ews (with a Outlook addin Button)the "BeforeItemMove" events are gone, and the user can move emails again freely. I can set the event handlers again, but than they won't always fire or stop working after some tries.
The same happens when user A works in Outlook with mailbox Z and user B accesses the same mailbox Zwith Outlook Web Access (OWA), after moving a mail the already set and working eventhandlers are gone or do not fire anymore.
User A has full rights to mailbox Z, User B is owner of mailbox Z.
If user B (owner) uses Outlook and OWA at the same time, everything works and the events won't get lost.
But I need two different users, because one user should not be able to move mails by himself, another user account should be used for that.
We use Exchange 2016, Outlook 2013, .NET 4 and the latest Ews assemblies from NuGet.
Why does Outlook loose a event when a mail gets moved by EWS or OWA? I don't get it.
Thanks and regards
How to upload registry settings?
How to retrieve mailItem.BillingInformation programmatically
In this project the user creates a document in a (DevExpress) word processor and then has the option to e-mail the document as an attachment. The customer uses Outlook, the Sent Mail folder being evidence that a mail was sent to the recipient. The word processor document is stored in a SQL database, and the user would like the option to store/recall the summary of the associated e-mail. The program opens Outlook, does the attachment and leaves it to the user to fill in the rest (To, Body, etc). I want to use the Billing Information text field to insert a key linking the e-mail and documents together.
This is what I do (note that I try both the Billing and Mileage fields):
mailItem = DirectCast(clsobjOutLook.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
attAttachments = mailItem.Attachments
attAttachments.Add(pstrSourceFile, Outlook.OlAttachmentType.olByValue, 1, clsstrInputDoc)
mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
mailItem.To = ""
mailItem.Importance = Outlook.OlImportance.olImportanceHigh
mailItem.ReadReceiptRequested = True
mailItem.BillingInformation = clsstrEstRefNo
mailItem.Mileage = clsstrEstRefNo
mailItem.Display(True)
' The user now deals with the mail item and sends it. The program now picks up:
objSentFolder = clsobjOutLook.Application.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail)
sentItems = objSentFolder.Items
folderItem = sentItems.GetFirst
While folderItem IsNot Nothing
sentItem = TryCast(folderItem, Outlook.MailItem)
If sentItem IsNot Nothing Then
If sentItem.BillingInformation = clsstrEstRefNo OrElse sentItem.Mileage = clsstrEstRefNo Then
strTest += vbCrLf & sentItem.Subject ' Used for development only!!!
End If
End If
folderItem = sentItems.GetNext
End While
strTest = "Estate Mail: " & strTest
MsgBox(strTest)
Whilst the mailing and scanning of the folder all works, I cannot find the value supposedly stored in the billing field! I get the subject field etc, but not the Billing (or Mileage) field.
Any ideas? Am I using the wrong field? Any other fields available?
Regards
Axel Trunk
How to restrict custom properties that not created in email item by vbscript?
Updating recurring occurences to a different room resource
Hi,
I've got a few questions around this actually based on the following scenario:
Created meeting with recurring daily/weekday pattern from let say 1st of month to 31st day of month.
There are 2 rooms which i can use for booking - Room1 and Room2
- On the 10th and 20th of the month, Room1 is unavailabile so should use Room2
- The rest of the days should be allocated to Room1
Room1 needs to be assigned as the priimary room resource for the majority, and Room2 needs to be created as exceptions with the room change to Room2.
Currently i'm trying to do the following, but it doesnt seem to assign the Room2:
In the outlook object model for AppointmentItem, which property does the room need to be add to - "Location", "Recipients" collection or "Resources"?
Code sample:
// use appointment AppointmentItem appointment = item as AppointmentItem; if (appointment.IsRecurring) { //get the recurring item from appointment var recurrencePattern = appointment.GetRecurrencePattern(); //find the primary room to use appointment.Recipients.Add(primaryRoom.Address); //loop through the allocated rooms in the schedule and update the appointment accordingly foreach (var scheduleEntry in _selectedScenario.Items) { //get the recurring item occurence for the entry start date var occurence = recurrencePattern.GetOccurrence(scheduleEntry.Range.Start); if (scheduleEntry.Address.Address != primaryRoom.Address) { //this is an exception as its using a different room occurence.Recipients.Add(scheduleEntry.Address.Address); } } }
any help appreciated thanks.
Can't get the Recipient Email Address to display correctly in the Sent Folder
So I've been using Outlook 2013 and 2016 on this issue but no luck so far. I've tried following the instructions (here; http://www.slipstick.com/developer/recipient-email-address-sent-items/?subscribeAnchor&subscriptionSuccess=1#wc_unsubscribe_message) to create a custom macro for it but it won't work. I don't know alot about macros but I tried following this guide here:
http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/
I tried posting the question over in the Outlook IT Pro Discussions section of this site but didn't really get to many responses.
Error:arguments are of the wrong type are out of acceptable range
Got the error when createParameter
Set objConn = CreateObject("ADODB.Command") Set objConn.activeconnection = oConnOutlook objConn.CommandTimeout = 60 objConn.CommandText = "spName" objConn.CommandType = &H0004 set param1 = objConn.createParameter("data1", vbvarchar, adParamInput, 20, "a value") oCmd.Parameters.Append param1 set param2 = oCmd.createParameter("number", vbString, adParamInput, 20, "123") oCmd.Parameters.Append param2 set rs = objConn.execute
How can I redraw/refresh the to-do bar in Outlook 2013 with VBA (and RDO if needed)?
I am using Outlook 2013. I have the To-Do Bar open on the right. I would like to make it so the flagged items it shows are only for the currently selected folder.
I am using Explorer_BeforeFolderSwitch to trigger every time I change folders. Then I use RDO to modify the "To Do Search" hidden search folder SQL to filter for only items in that folder (by the new folder's Entry ID).
Everything works except the To-Do Bar does not automatically refresh. I have to change into something else like the Calendar and then switch back to the Inbox for the To-Do Bar to refresh.
' the current explorer object Private WithEvents nOutlookExplorer As Explorer ' set the explorer object Private Sub Application_MAPILogonComplete() Set nOutlookExplorer = Application.ActiveExplorer End Sub ' triggered every time i change folders Private Sub nOutlookExplorer_BeforeFolderSwitch(ByVal NewFolder As Object, Cancel As Boolean) Dim nSession As Object Dim nToDoSearchFolder As Object ' get an RDO session Set nSession = CreateObject("Redemption.RDOSession") nSession.Logon ' find the to do folder, get its EntryID then get the folder Set nToDoSearchFolder = nSession.GetFolderFromID(nSession.GetDefaultFolder(olFolderToDo).EntryID) ' set the filter to flagged items whose parent folder matches this folder nToDoSearchFolder.SearchCriteria.AsSQL = Chr(34) & "http://schemas.microsoft.com/mapi/proptag/0x10900003" & Chr(34) & " <> 1 AND " & Chr(34) & "http://schemas.microsoft.com/mapi/proptag/0x10900003" & Chr(34) & " <> 0 AND " & Chr(34) & "urn:schemas:httpmail:messageflag" & Chr(34) & " IS NOT NULL AND " & Chr(34) & "http://schemas.microsoft.com/mapi/proptag/0x0E090102" & Chr(34) & " = '" & NewFolder.EntryID & "'" nToDoSearchFolder.Start Set nToDoSearchFolder = Nothing Set nSession = Nothing End Sub
Outlook PST repair Tool
How can I add a ribbon group to Home tab in inbox view?
I have created an addin for outlook and I want to add a ribbon group to home tab of Inbox view. I was able to add ribbon group in reply,forward and new mail pop out window.
Can anyone suggest me a solution?
Thanks in advance.
Microsoft Outlook stops working when loading the Sample Address Book Provider https://ol2010mapisamples.codeplex.com/releases
Hi,
I have had this problem for awhile with using the Sample Address Book Provider.
When opening the Sample Address Book in Outlook, Outlook will crash.
If I debug the Sample Address Book Provider project, Visual Studio 2013 will catch the Exception and allow me to continue.
The Address Book entries load properly and I can close Outlook.
In the Output window of VS2013 I find the following entries :
Critical error detected c0000374
OUTLOOK.EXE has triggered a breakpoint.
First-chance exception at 0x778DC7A9 (ntdll.dll) in OUTLOOK.EXE: 0xC0000374: A heap has been corrupted (parameters: 0x77908890).
Unhandled exception at 0x778DC7A9 (ntdll.dll) in OUTLOOK.EXE: 0xC0000374: A heap has been corrupted (parameters: 0x77908890).
Actually I am working with a customised version of the sample project but I believe I have also replicated this issue in the original sample project downloaded direct from https://ol2010mapisamples.codeplex.com/releases
I have installed the customised address book on end user systems where it seems to work, so I am not sure if this issue could depend on the version of Outlook / MAPI installed or somehow because I am using a development machine.
I think that this issue should be resolved so I can have confidence in installing this address book on other computers.
Regards, (Mr) Kim Groves
Wrong context is given to a Ribbon button in Excel (scenario supplied)
Hello,
Create a new Excel 2013-2015 VSTO add-in project. Add the the following Ribbon XML:
<?xml version="1.0" encoding="UTF-8"?><customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load"><ribbon><tabs><tab idMso="TabAddIns"><group id="Group1" label="Group1"><button id="button1" getLabel="GetLabel"/></group></tab></tabs></ribbon></customUI>
Add the following code to Ribbon1.cs:
public string GetLabel(Office.IRibbonControl control) { string result = "(unknown)"; object context = control.Context; if (context is Excel.Window) { Excel.Window window = context as Excel.Window; result = window.Caption; } return result; } public void InvalidateControl(string id) { this.ribbon.InvalidateControl(id); }
Add the following to ThisAddIn.cs:
private void ThisAddIn_Startup(object sender, System.EventArgs e) { this.Application.WindowActivate += Application_WindowActivate; } void Application_WindowActivate(Excel.Workbook Wb, Excel.Window Wn) { string message = "!!! " + Wb.Name + " " + Wn.Caption; System.Diagnostics.Debug.WriteLine(message); ribbon1.InvalidateControl("button1"); } Ribbon1 ribbon1 = null; protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject() { ribbon1 = new Ribbon1(); return ribbon1; }Build the add-in, open two workbooks and make the ribbon tab active. Everything goes as expected if you activate the Excel windows by clicking on the window caption area: the buttons show the caption of the corresponding Excel window on them. If however you activate an Excel window by clicking an arbitrary cell, the Ribbon buttons on both active and inactive windows get updated with the same context; accordingly they display the same caption which is wrong. I reproduce this issue on Excel 2013 and 2016. I use VS 2013 with Update 5. I'm ready to provide extra info if required.
Regards from Belarus (GMT + 3),
Andrei Smolin
Add-in Express Team Leader
Please mark answers and useful posts to help other developers use the forums efficiently.
Can Items.Restrict be used to search ConversationID
Is the ConversationID like the GlobalAppointmentID in that if you try and use it in the Items.Restrict method you'll get an Invalid Condition returned?
Microsoft doesn't explicitly tell you that you cannot use the GlobalAppointmentID in a search, but I've found out over time that it cannot be used in the Restrict or Find methods. I'm wondering if the same applies for the ConversationID.
NOTE: I'm not going to bother with adding a property to the AppointmentItem to search only for reasons particular to our environment.
If you have seen it done, please provide a link; I've tried a few ways already ... i'm interested in a proven solution.
Error removing a SearchContainer from a search folder RDO
Hello.
The below code should, I think, remove a search folder from a SearchFolder's SearchContainer list. However, it errors on the remove line (step 6):
Dim nSession As Object Dim nSearchFolder As Object ' get the session Set nSession = CreateObject("Redemption.RDOSession") nSession.MAPIOBJECT = Application.session.MAPIOBJECT ' get my test search folder Set nSearchFolder = nSession.Stores.defaultstore.SearchRootFolder.Folders("test") ' this line works as expected Debug.Print "1) nSearchFolder.Name = " & nSearchFolder.Name ' this line works as expected Debug.Print "2) nSearchFolder.SearchCriteria.AsSQL = " & nSearchFolder.SearchCriteria.AsSQL ' this line works as expected Debug.Print "3) nSearchFolder.SearchContainers.Count = " & nSearchFolder.SearchContainers.Count ' this line works as expected Debug.Print "4) nSearchFolder.SearchContainers.Item(1).Name = " & nSearchFolder.SearchContainers.Item(1).Name ' this line works as expected Debug.Print "5) nSearchFolder.SearchContainers.Item(2).Name = " & nSearchFolder.SearchContainers.Item(2).Name ' !!!!! here is where it fails Debug.Print "6) nSearchFolder.SearchContainers.Remove 2" nSearchFolder.SearchContainers.Remove 2 Debug.Print "7) nSearchFolder.Save" nSearchFolder.Save Set nSearchFolder = Nothing Set nSession = Nothing
This is the output:
1) nSearchFolder.Name = test 2) nSearchFolder.SearchCriteria.AsSQL = ...removed for brevity 3) nSearchFolder.SearchContainers.Count = 2 4) nSearchFolder.SearchContainers.Item(1).Name = Inbox 5) nSearchFolder.SearchContainers.Item(2).Name = Drafts 6) nSearchFolder.SearchContainers.Remove 2
And this is the error:
Any idea what is wrong?
Unable to use & in RDO's SearchFolder.SearchCriteria.AsSQL
I am trying to set the SearchCriteria for a search folder by copying the one for "To-Do Search" and getting an error.
Set nSession = CreateObject("Redemption.RDOSession") nSession.MAPIOBJECT = Application.session.MAPIOBJECT Set nStores = nSession.Stores Set nDefaultStore = nStores.defaultstore Set nSearchRootFolder = nDefaultStore.SearchRootFolder Set nFolders = nSearchRootFolder.Folders Set nToDoSearchFolder = nFolders.Item("To-Do Search") Set nTempSearchFolder = nFolders.Item("test") ' output of this is below Debug.Print nToDoSearchFolder.SearchCriteria.AsSQL ' output of this is below Debug.Print nTempSearchFolder.SearchCriteria.AsSQL ' try to set the test one to the todo one and it gets an error nTempSearchFolder.SearchCriteria.AsSQL = nToDoSearchFolder.SearchCriteria.AsSQL
The SQL of the "To-Do Search" folder is:
((NOT (MessageClass LIKE 'IPM.Appointment%')) AND (NOT (MessageClass LIKE 'IPM.Activity%')) AND (NOT (MessageClass LIKE 'IPM.StickyNote%'))) AND ((("http://schemas.microsoft.com/mapi/proptag/0x0E090102" <> 'EF000000566DF349282A75418D7FCC22AD95C65562210000') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E090102" <> 'EF000000566DF349282A75418D7FCC22AD95C655E2830000') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E090102" <> 'EF000000566DF349282A75418D7FCC22AD95C655C2800000') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E090102" <> 'EF000000566DF349282A75418D7FCC22AD95C655A2210000') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E090102" <> 'EF000000566DF349282A75418D7FCC22AD95C65502850000') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E090102" <> 'EF000000566DF349282A75418D7FCC22AD95C65522850000') AND ("http://schemas.microsoft.com/mapi/proptag/0x0E090102" <> 'EF000000566DF349282A75418D7FCC22AD95C655E2840000')) AND (((((NOT (FlagIcon IS NOT NULL)) OR (FlagIcon = '0')) AND (FlagStatus IS NOT NULL) AND (FlagStatus = '1')) OR ((Status = '2') AND (Status IS NOT NULL))) OR (("http://schemas.microsoft.com/mapi/proptag/0x0E2B0003" IS NOT NULL) AND (("http://schemas.microsoft.com/mapi/proptag/0x0E2B0003" & 1) <> 0)) OR ((FlagIcon IS NOT NULL) AND (FlagIcon > '0')) OR ((NOT (("http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/8108000B" <> 'True') AND ("http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/81130003" = '2'))) AND ((MessageClass LIKE 'IPM.Task.%') OR (MessageClass = 'IPM.Task')))))
The error is:
Run-time error '-2147418113 (8000ffff)': Assertion failed: Number of constants == 1
I have narrowed it down to this:
("http://schemas.microsoft.com/mapi/proptag/0x0E2B0003" & 1) <> 0
So I guess the question is how to do a binary AND using AsSQL?