Is there any way to copy the outlook rule of one account to another account using VBA code. I have researched on the internet I have not found anything related to my question, Pls help me. I will be very thankful to you.
The Outlook object model doesn't provide any property or method for that. However, you can use a low-level functionality to access rules. Use the PropertyAccessor object to get and set item-level properties that are not explicitly exposed in the Outlook object model, or properties for the following non-item objects: AddressEntry, AddressList, Attachment, ExchangeDistributionList, ExchangeUser, Folder, Recipient, and Store.
Rules are kept as hidden items in your Inbox folder (see the associated content which is not visible in the Outlook UI). You may use MFCMAPI or OutlookSpy for exploring the hidden content.
Related
With the Outlook UI you can add an email address to your junk-email list, you can add a domain name as trusted domain, but you can't add a domain name to your junk-email list. You must manually edit the email address in your junk-email list to achieve that, so I wrote an Add-In to do this for me, but cant find the method to do that. Apparently the Outlook object model doesn't provide anything for that.
Is there a code workaround for this fatal limitation?
That is correct. Outlook Object Model does not provide any means to access or manipulate Junk Email settings.
You can try to use Extended MAPI (C++ or Delphi) to build the MAPI server side rule that lists all the blocked senders, but it is definitely not for the faint-hearted.
If using Redemption (I am its author) is an option, it exposes RDOJunkEmailOptions object (returned from RDOSession.JunkEmailOptions, RDOAccount.JunkEmailOptions, RDOExchangeMailboxStore.JunkEmailOptions), which allow to add blocked senders using RDOJunkEmailOptions.BlockedSenders.Add.
In Outlook versions after 2007 Microsoft added the possibility to manually arrange folders in folders tree (in Outlook 2007 folders were arranged alphabetically).
Is there any possibility using VBA to arrange folders in the folders tree, e.g. put folder to the top when it contains new email?
Thanks
Starting from Outlook 2013 you can reorder folders however you like and Outlook would remember the order. The key property is PR_SORT_POSITION. Here’s the definition:
define PR_SORT_POSITION PROP_TAG( PT_BINARY, 0x3020)
Outlook will use this property as part of it’s sort order when requesting folders from a provider, so it’s important that your provider can handle sorting on a binary property – or can fake it when asked to sort by this property. Outlook will also use this property directly when deciding where to insert nodes in the visible tree, so it’s also important that your provider can return this property when Outlook looks for it on a folder.
There’s a second property Outlook will use for custom sort ordering:
define PR_SORT_PARENTID PROP_TAG( PT_BINARY, 0x3021)
As the name suggests, this property stores an entry ID which can be used to sort a folder under a different node than it’s natural parent. Normally, a folder will be sorted under the folder represented by PR_PARENT_ENTRYID. This property allows you to suggest a different parent for display.
By presetting these properties appropriately, you can direct Outlook in how you wish your provider’s folders to be sorted. And if you allow Outlook to write to these properties, you can preserve whatever sort order your users desire.
So, theoretically you can set these properties from VBA. The PropertyAccessor class can help you with such tasks. Also you may consider using a low-level code if you face with any restrictions from OOM, so any wrappers around Extended MAPI allows to bridge the gap (for example, Redemption).
I have a SharePoint discussion board sycned to Outlook 2010.
I want to be able to programmatically modify my posts within a SharePoint Discussion Board within Outlook VBA and have these changes reflected on the online discussion board.
The below code works in a test case to modify the items on the Outlook side but it is not synchronizing with SharePoint.
Private Sub modifySharePointItem()
Dim obj As Outlook.PostItem
Set obj = Application.ActiveExplorer.Selection.item(1)
obj.Body = obj.Body + "test addition"
obj.Save
obj.Post
End Sub
I am assuming I need to not just Save and Post but an additional "synchronize" type command but I do not know what it is.
Reading about the data model for PostItem was basically useless unfortunately and none of the methods seemed to do what I was interested in.
I found out (by accident.....) I am able to delete posts from Outlook - so I can obviously get much of the way here, but I still am unsure how to sync the lists when items are modified.
You can use the Client Object Model to do modifications and editing in Sharepoint. I do it all the time. Since Outlook 2010 compiles down to the CLI you could use the Client Object Model dlls to do what you need. I have a whole bunch of C# code that I could share if you need it. This is what I used to get started.
http://msdn.microsoft.com/en-us/library/ee537247(v=office.14).aspx
I hope that helps!
I am writing an Outlook addin that inserts content into an email, and I have a emailSent event that I would like send an event back to my server letting me know some content was shared.
Is there a way to attach some meta information to the email (or the word doc, which is what you are creating in outlook) so that I can grab that meta info so I can send it back to my server.
Right now, the only way I think I can do it is to search through the email on the send event looking for my content with regex and pull out the info i need, but that seems cumbersome, and also means I need to run the regex for every email sent, even when they haven't added my content.
There is the concept of MAPI user properties, which you can add to an Outlook item. Since Office 2007 the object model allows access to them. If your add-in must run also with older Outlook version, you should recurr to use Redemption (which I prefer also for higher office versions because it has more flexibility, albeit a greater footprint in distribution).
See UserProperties Interface on MSDN.
I have a question reffering to Public Folders on Exchange Server.
I have an application (Outlook Com Addin) that need to share settings amonge every Exchange User that have access to Public Folders.
I was thinking about storing settings in MAPI assotiated message (hidden MAPI message). Wirting\Reading data from this message works fine, but I don't have good place to save this item.
I am looking from some sort of global folder or root folder that every user have. I tried All Public Folders folder, but noone can store any item there. I was also thinking about NON_IPM_SUBTREE but I am not sure which folder can be used to write there something.
Maybe someone faced this problem already and have some thoughts about this it?
And to make things clear. I am using Extended MAPI, but if you know any solution that involves Outlook API, I would be interested in that too.
Best regards,
There are no predefined PF folders. Most installations will have "Outlook Security Settings", but that is about it.
There is also a set of hidden folders where Outlook stores f/b info.
Keep in mind that PF is optional as of Exchange 2007. Exchange 2010 does not install PF store by default.