PC Review


Reply
Thread Tools Rate Thread

How do I change the display name of a .pst store

 
 
escamoteur
Guest
Posts: n/a
 
      28th Jul 2009
Hi,

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
 
Reply With Quote
 
 
 
 
escamoteur
Guest
Posts: n/a
 
      28th Jul 2009
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
 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      28th Jul 2009
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


 
Reply With Quote
 
Brian Tillman [MVP - Outlook]
Guest
Posts: n/a
 
      28th Jul 2009
"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


Seems easier to me to just change it with the Outlook UI.
--
Brian Tillman [MVP-Outlook]

 
Reply With Quote
 
escamoteur
Guest
Posts: n/a
 
      28th Jul 2009
The point is, that my Add-In should initialize it's folder structure automatically at the first Start. So Asking the user to change
the Name is a bit way out


"Brian Tillman [MVP - Outlook]" <(E-Mail Removed)> schrieb im Newsbeitrag news:(E-Mail Removed)...
> "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

>
> Seems easier to me to just change it with the Outlook UI.
> --
> Brian Tillman [MVP-Outlook]


 
Reply With Quote
 
escamoteur
Guest
Posts: n/a
 
      29th Jul 2009
Hi,

I just found Out, that if you only want to change the name, the user sees in Outlook for the new store, it's enough just to change
the "Name" of the Defaultfolder of the store.

Outlook.MAPIFolder rootFolder = (Outlook.Folder) AO_Store.GetRootFolder();
rootFolder.Name = "ArtistsOrganizer";


Tom

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the display name of a .pst store escamoteur Microsoft Outlook VBA Programming 5 29th Jul 2009 10:00 AM
How do I change the display name of a .pst store escamoteur Microsoft Outlook Interoperability 5 29th Jul 2009 10:00 AM
reinstalled OL- cannot change store or get previous store up MikeR-Oz Microsoft Outlook 8 19th May 2008 01:19 PM
Display one value but store another [WebGrid] Oliver Orsteck Microsoft ASP .NET 0 22nd Nov 2005 08:57 AM
Custom Comboboxes to display one value and store another Dan Keeley Microsoft VB .NET 1 17th Nov 2003 06:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:30 AM.