It looks like you can't set that property using the PropertyAccessor object.
When MS added that way of accessing properties not exposed in the object
model some were restricted for read or write access. The explanation is that
those restricted properties are important to the business logic of Outlook
and so aren't available to the user for unrestricted access.
It looks like PR_DISPLAY_NAME on a Store is one of those properties. I
verified the problem using both the Unicode property tag you used as well as
the ANSI equivalent (ending in 0x1E instead of in 0x1F) and write access was
restricted in both cases. Read access works.
I was able to change the property value using OutlookSpy, so that means that
if you use Extended MAPI or another API such as Redemption
(
www.dimastr.com/redemption) or even CDO 1.21 you would be able to change
that property value.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"escamoteur" <(E-Mail Removed)> wrote in message
news:466A3D85-C526-489D-AA4F-(E-Mail Removed)...
>I tried to change the display name of a newly added .pst store
>
> theApp.Instance.Application.Session.AddStoreEx(path,Microsoft.Office.Interop.Outlook.OlStoreType.olStoreUnicode);
> //Find Our Store with WorkAround over FilePath
> Outlook.Stores stores=theApp.Instance.Application.Session.Stores;
> foreach (Outlook.Store store in stores)
> {
> if (store.FilePath== path)
> {
> AO_Store = store;
> string
> PR_DISPLAY_NAME=@"http://schemas.microsoft.com/mapi/proptag/0x3001001F";
> Outlook.PropertyAccessor oPA=store.PropertyAccessor; try
> {
>
> oPA.SetProperty(PR_DISPLAY_NAME,"ArtistsOrganizer"); }
> catch (Exception e)
> {
> Debug.WriteLine(e.Message);
> }
> }
> }
>
> But I get an access denied exception when I run this.
>
> All the bestTom