Saving program shared data in Exchange Public Folder - com

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.

Related

Copy one account client-side rule to all client-side rules

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.

Get all Outlook emails (including ones on server)

Edit3: I think I'm going to include Microsoft Graph API as well. Using the interop is acceptable as long as enough data is cached. Otherwise, I'll use the online method.
Edit2: I'd even be fine with changing Outlook's offline settings, but prefer to not have to do this for all folders.
Edit: Programmatically accessing archived mails in an Exchange folder
The third suggestion listed seems to be what I'm looking for. It's possible I've opened an instance in cached mode. I'm not sure yet how to do that through the interop.
This post helped me out: Interop.Outlook - get all emails(Items) within a subfolder
My issue is that it only retrieves some of the messages. I believe it has to do with how many messages Outlook has synced. If I browse the folder in Outlook, the bottom of the list says "Click here to view more on Microsoft Exchange". When clicked, naturally, it shows the rest of the messages.
Is this possible through the interop?
Add-Type -LiteralPath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.Outlook.dll"
$oApp = [Microsoft.Office.Interop.Outlook.ApplicationClass]::new()
$oNamespace = $oApp.GetNamespace("MAPI")
$TargetFolder = $oNamespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderInbox)
$MailItemsWithAttachments = $TargetFolder.Items | Where-Object {$null -ne $_.Attachments} | Select-Object Subject, Attachments
The last line is where I assume needs adjusting. Feel free to provide an example in VB/C#, I'm familiar with both.
What is happening is it's pulling only what is cached for you, you will not be able to pull any more unless you set the cache period to "All" or disable the caching. You can disable by going to account settings, click "change" and then uncheck use cached exchange mode.

Assign folder permissions in Outlook 2010 with VBA

Morning,
I'm trying to identify a way of updating permissions to an Outlook 2010 inbox and all of its subfolders with VBA.
We have an account with a large amount of subfolders that several new users need access to. To assign each of these manually will take hours and I'm looking for an automated process, as this will be a reoccuring task.
Due to administrator restrictions I'm only able to use native VBA.
Is this possible, or am I doomed to hours of mundane repetitive pointing and clicking?
Many thanks
Pete
The Outlook object model (used in VBA) doesn't provide anything for changing folder permissions.
You can use a low-level API - Extended MAPI for accessing permissions. Folder level permissions are stored in folders. You need to get the PR_ACL_TABLE property value using the IMAPIFolder::OpenProperty method. Or you may consider using any third-party wrappers around that API that simplify the dev process. See Changes in Outlook 2010 folder permissions not shown in Active Directory for more information.
Since you are using VBA, Extended MAPI is out of the question (you'd need C++ or Delphi).
If using Redemption is an option (I am its author), you can use its RDOACL object (returned by RDOFolder.ACL property) to manage any Exchange folder permissions:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Folder = Session.GetDefaultFolder(olFolderCalendar)
'make sure we get back an Exchange user
set AddressEntry = Session.AddressBook.GAL.ResolveName("Pete")
set ACE = Folder.ACL.Add(AddressEntry)
ACE.Rights = ROLE_PUBLISH_EDITOR

Outlook Shared Inbox Macros

I will try to be as clear as possible. There are 5 people on my team. We each have our own personal outlook email accounts. Our team leader is ALSO the owner of an account that we all have access to (call it "SharedAccount#xx.com"). I have macros that I want to put into that shared email account, that will listen to the inbox of that email account and do stuff with the incoming messages. Since I am not the owner of that account, I wrote Macros in my personal email and for the NameSpace business I used the following code (note, again, this is in MY personal email ThisOutlookSession):
Dim objNS As Outlook.NameSpace
Set objNS = olApp.GetNamespace("MAPI")
Dim rec As recipient
Set rec = objNS.CreateRecipient("SharedAccount#xx.com")
rec.Resolve
Set inbox = objNS.GetSharedDefaultFolder(rec, olFolderInbox)
Am I doing this wrong? Do I instead need to put this code into the macros on the "Shared#xx.com" account profile? I know the macros work in regards to the listeners and all that, so the problem has something to do with NameSpaces I feel like. I would really, really appreciate any help I can get. Thank you!
Each user normally accesses their own VbaProject.otm file. See VbaProject.OTM deployment for a description of "a parameter altvba that allows to specify another path to run the OTM file from".
If that is not feasible you could use one of the methods described here. http://www.outlookcode.com/article.aspx?id=28 also referenced in the above.
"The least intrusive technique is to use the File | Export command in the Outlook VBA environment to export modules as .bas, .cls, and .frm files."
"The brute force approach is to copy this file from the machine where the macros were written to other users' machines, replacing any existing VbaProject.otm file." (Not very nice.)
It is easiest for me to send a mail, then paste the text into their editor.

Persisting VBA/VBScript macro settings

I've created an Outlook (2010) VBScript macro that has some user-configurable settings. I've googled and checked the likely resources and can't figure out a good way to persist them. I'm currently storing them in the body of a mail item! It don't get much kludgier than that!
Should I use the Windows registry? An ini file? Or??? And whether registry, file, or???, what key/folder/??? would I use?
Just before hitting 'Post' on this I tried one more google search and hit on this: http://www.jkp-ads.com/articles/DistributeMacro08.asp.
The gist I took away was, ini file or registry are both kosher. One nice thing about VBA's use of the registry is it automatically puts "app" data in the approved place, just need to give your "app" a key. Since my data is just a big string with parsing code already in place, I used strData = GetSetting(strAppKey, strSection, strLeafKey) and SaveSetting(strAppKey, strSection, strLeafKey, strData) and voila, all is good.
The standard Outlook way of storing settings, especially if they relate to a particular mailbox/store and can be accessed from multiple machines connected to the same mailbox, is to use a hidden message stored in one of the well known folders, such as the Inbox.
The hidden MAPI messages can be accessed using MAPIFolder.GetStorage: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mapifolder.getstorage.aspx