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!
Related
I have a VBA function in our MS Access database that generates Outlook emails and sends them from a shared inbox.
Our company uses Azure Information Protection to protect documents. A label needs to be applied to each email before it is sent (e.g. Public, Business Sensitive, Internal).
Rather than having the user click the label 25 times as it pops up for each email, I am trying to apply it programmatically.
I get error code (-1248837627).
My solution was to grab the labels GUID and then apply it to the email as below. I came across other solutions such as using SendKeys but I prefer it to be a last resort.
With olMail
.To = olSendTo
.Subject = olSubject
.PermissionTemplateGuid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX"
.Permission = olPermissionTemplate
'And so on, the email function works great until the above two lines are added
Am I applying the .Permissions or .PermissionTemplateGUID improperly?
I have seen a similar approach to apply labels to Excel documents (grabbing and setting the guid).
The code you posted is used to specify Information Rights Management (IRM) permissions. Azure Information Protection is another story.
You need to add a user property in the following format:
"MSIP_Label_" & guid_internal_use_only & "_Enabled"
But I'd suggest exploring internals of Outlook mail items using MFCMAPI or OutlookSpy to find the exact solution. Try to set it manually then explore internals using these tools.
Problem
I need to get online presence status from Microsoft Outlook using VBA.
The status is presented as a green-yellow-red-grey light displayed near the contact name and usually provided by some instant message(IM) application (e.g. Teams, Skype, Zoom, Jabber etc.).
Here is how it is usually look:
Available data
Unfortunately the status is not available in Outlook structures AddressEntry or ExchangeUser, which are pretty easy to acquire.
Note: Please do not confuse online presence with calendar availability, which can easily retrieved using function GetFreeBusy.
Alternative view
The only relevant and pretty decent description related to the topic I found here: https://learn.microsoft.com/en-us/office/client-developer/shared/integrating-im-applications-with-office .
But here the topic is presented from the different angle - what should be done from the IM application side to provide this status. In short: the IM app should add some data to the registry under ...\Software\IM Providers\... and implement interface IUCOfficeIntegration, so Outlook can use it to retrieve the status.
So an intermediate idea was to retrieve the status via this interface from the IM app directly. But there is very few information about calling COM interfaces from VBA.
Does anyone can provide any hints how the status can be retrieved?
The Outlook object model doesn't provide any property or method for that. Graph API provides the Get presence methods for that.
You can use Graph for that. I don't think you'd be able to use VBA though.
https://learn.microsoft.com/en-us/graph/api/presence-get?view=graph-rest-1.0&tabs=http
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.
Although Im quite experienced with Excel VBA, Im not so much in regards of Outlook VBA (started yesterday, literally), so Im uncertain on how to get this simple task accomplished:
I created some coding to get a specific e-mail from the Inbox and then parse it and forward - that part is all good and well. Currently the code autodetects and retrieve the e-mail item using a set of parameters to filter through the Inbox. However, now I need to expand this code so that it can work with any e-mail item, and not only with that specific e-mail.
My idea is to get the user to input which e-mail item he/she wants to parse and forward, instead of getting the code to look in a specific place. How can that be done? The user input methods that I use regularly are InputBox (which returns a string) and GetOpenFileName, none of them suitable to pointing to a mail item within Outlook.
I thought about making the code work with the currently open e-mail item, but often the users have several e-mail items opened at once - forcing them to leave only one open for the code to work is not viable. Also, the code will be ran by people who have little to no IT expertise, so requesting things such as paths is also not an option. Is there any method for this?
I figured that working with Active MailItem is the way to go, as #niton suggested as well. I used a coding very similar to the one in this post, although I had to develop the handlers in case the user has other types of Objects active at the moment (AppointmentItems, for instance) or have multiple items selected. Final solution wasn't that much elegant - I was wishing for some sort of system input box where the user could point to the mail or something, but this works.
I am at the copy and edit stage of using VBA and have searched and searched for a code which gets me close but I am used to using VBA for excel not for outlook.
I have a shared calendar which many people add to (internally), once this is complete at the end of the day the appointments relevant to certain external people are added to their calendars, at the moment this is done by manually copying the appointments to the external peoples calendars.
It there a way to write some code which will do this automatically?
All calendars are on outlook and shared via exchange.
Any help is appreciated.
Jon
The Namespace class provides the GetSharedDefaultFolder method which returns a Folder object that represents the specified default folder for the specified user. So, you can access a shared calendar and copy/move items. To get the job done you need to use the Copy and Move methods in the following way, a raw sketch:
Set myCopiedItem = myItem.Copy
myCopiedItem.Move myNewFolder
Finally, you may find the Getting Started with VBA in Outlook 2010 article in MSDN helpful.