|
|
Hi,
In order to store my own custom data with an item i used named properties, and add them via REDEMPTION .HrSetOneProp method , is the same possible with folder, and how????
I want create custom property to ost folder e.g. userID property.
By using .HrSetOneProp .. .. .... and passing folder obbject end up with exception.
Anyone????
TNX in Advance.
|
|
Whenever you need a custom property, it must be a named property (see http://www.dimastr.com/redemption/utils.htm#xmapi and scroll to the Named Properties section) to make sure it does not conflict with anybody's else property. Also note that while folders in PST stores support named properties, Exchange folders do not. The standard way to store folder-wide properties is to create a hidden (associated) message in that folder with a custom message class and use it to store the data - see RDOFolder.HiddenItems (http://www.dimastr.com/redemption/rdo/RDOFolder.htm)
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1176740113.014945.109830[ at ]d57g2000hsg.googlegroups.com...
[Quoted Text] > Hi, > > In order to store my own custom data with an item i used named > properties, and add them via REDEMPTION .HrSetOneProp method , > is the same possible with folder, and how???? > > I want create custom property to ost folder e.g. userID property. > > By using .HrSetOneProp .. .. .... and passing folder obbject end > up with exception. > > > Anyone???? > > > TNX in Advance. >
|
|
Thanks fo replay,
So the add Property option in OutlookSpy's IMAPIFOlder is only for pst folders??? By the way in order to add property (named) in mail item via OutlookSpy when i should set a property name???
Thanks.
|
|
1. You can set a regular property on a folder when using the Exchange provider of course, but it will fail for a property in the >= 0x80000000 range. 2. Click IMessage button on the OutlookSpy toolbar, then click "Add Property" button.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1176746213.853586.310480[ at ]q75g2000hsh.googlegroups.com...
[Quoted Text] > Thanks fo replay, > > So the add Property option in OutlookSpy's IMAPIFOlder is only for pst > folders??? > By the way in order to add property (named) in mail item via > OutlookSpy when i should set a property name??? > > > > Thanks. >
|
|
Thanks,
[Quoted Text] >2. Click IMessage button on the OutlookSpy toolbar, then click "Add >Property" button.
But where in appeared dialog form i set the name for property??? and ID ?? how should i get it or calculate it.
Dmitry maybe there is workaround concerning the folder's proeperty?? All i need to save is one property and every time create RDOFolder and check for hidden item and get the property from this item it will strike the performance. I should check for this property every time for every mail that i get.
Thanks in advance.
|
|
Select the "This is a named property" radio box, then in the ID edit box specify either an integer ID (if Kind = MNID_ID) or a srting name (if kind = MNID_STRING). What that id/name is up to you. Same with the GUID: if you want to make sure nothing ever collides with your custom tag, pick your own ubique GUID. As for perfromance, why can't it be stored in the registry? Or cached in memory?
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1176750557.160963.271070[ at ]w1g2000hsg.googlegroups.com...
[Quoted Text] > > Thanks, > >>2. Click IMessage button on the OutlookSpy toolbar, then click "Add >>Property" button. > > But where in appeared dialog form i set the name for property??? and > ID ?? how should i get it or calculate it. > > > Dmitry maybe there is workaround concerning the folder's proeperty?? > All i need to save is one property > and every time create RDOFolder and check for hidden item and get the > property from this item it will strike the performance. > I should check for this property every time for every mail that i get. > > > Thanks in advance. >
|
|
Thanks it works, is it possible to add hidden items to folder via OutlookSpy?? Is it possible to to view for hidden items in some folder via OutlokSpy (or only to write scipt in the Script Editor )??
Suppose i have 20 folders or more and for each folder i should add property e.g. userID, for example 3 folders may have same userID property other userID in 2 folders and so on, so in this case i should create some dictionary list that will have form userID | FolderName and for each item arrive (a lot items will arrive pereodically) i should get the property (named) userID from arrived mailItem check to wich folder (via dictionary) it's belong and then move. So in the addIn startUp i should iterate over all my folder tree and build the dictionary.
Any suggestion, to how implement the scenario above???
Thnx,.
|
|
OutlookSpy does not let you add new mesages, neither regular nor associated. There is no specific reason, it is just nobody asked for that feature :-) To see tehe existing hidden items, click IMAPIFolder button, then go to the "Associated Contents" tab. You did not answer *why* exactly you want to store data on the folder level rather than registry or file system.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1176758103.342108.193550[ at ]q75g2000hsh.googlegroups.com...
[Quoted Text] > Thanks it works, is it possible to add hidden items to folder via > OutlookSpy?? Is it possible to to view for hidden items > in some folder via OutlokSpy (or only to write scipt in the Script > Editor )?? > > > Suppose i have 20 folders or more and for each folder i should add > property e.g. userID, > for example 3 folders may have same userID property other userID in 2 > folders and so on, > so in this case i should create some dictionary list that will have > form userID | FolderName > and for each item arrive (a lot items will arrive pereodically) i > should get the property (named) userID from arrived mailItem > check to wich folder (via dictionary) it's belong and then move. > So in the addIn startUp i should iterate over all my folder tree and > build the dictionary. > > > Any suggestion, to how implement the scenario above??? > > > Thnx,. >
|
|
The reason to store data on the folder level rather than registry or file systems is beacause if some user change his machine or format it's machine all data stored on registry or file system level are erased or not available (in case user logged in to other machine and open Outlook). However when i store data on folder level, it doesn't matter, cause when user log in to some machine and configured Outlook to work against Exchange all data and my data also are syncronized.
What do you think???
Thnask in advance.
|
|
Ok, then a hidden item is the way to go. What kind of data are you storing? Is it really per-folder? If not, you can store everything as a hidden message in, say, Inbox. I don't see this as a performance problem as long as you read the data only wwhen you actually need it and cache it in memory for the lifetime of your app.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1177856498.993716.164290[ at ]y80g2000hsf.googlegroups.com...
[Quoted Text] > > > The reason to store data on the folder level rather than registry or > file systems is beacause > if some user change his machine or format it's machine all data stored > on registry or file system level are > erased or not available (in case user logged in to other machine and > open Outlook). However when i store > data on folder level, it doesn't matter, cause when user log in to > some machine and configured Outlook to work > against Exchange all data and my data also are syncronized. > > What do you think??? > > > Thnask in advance. >
|
|
Thank you for replay.
The data i need to store are user's details id, user name, ....
Each user has his own folder and sub-folders and also may have other users folders (delegate) and to these folders i need to store data. I think it's better to store hidden item per user's folder e.g. i have folder AAAAA inside this folder i create hidden item with user's details, for subfolder i wouldn't ceate hidden item, cause i can check where i locate in hierarchy
How i set named properties to hidden item via redemption?? that's what i do:
........... ......... RDO.RDOFolder rFolder = RdoSession.GetFolderFromID(folderEntryID, folderStoreID, Type.Missing); RDO.RDOItems rHiddenItems = rFolder.HiddenItems;
/*i will identify my hidden item by subject.*/
..... i check here if item with such subject already exists
rHiddenItem = rFolder.HiddenItems.Add("IPM.Note"); rHiddenItem.Subject = ... some constant string .....; rHiddenItem.Save();
here i shlould add named properties, how should i add them ?? by help of MAPIUtils.HrSetOneProp(rHiddenItem.MAPIOBJECT, propID, ................. or there are other posibilities?? and also for get these properties.
Thanks in advance.
|
|
1. Your code should be adding the hidden item only once. Check that the message already exists in the HiddenItems collection (pass the appropriate subject to the RDOItems.Item method). If NULL is returned, call HiddenItems.Add. 2. A property can be added using RDOMail.Fields - see http://www.dimastr.com/redemption/rdo/MAPIProp.htm . There is abolsutely no reason to use MAPIUtils object in this case.
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1177965228.348764.108510[ at ]y5g2000hsa.googlegroups.com...
[Quoted Text] > Thank you for replay. > > The data i need to store are user's details id, user name, .... > > Each user has his own folder and sub-folders and also may have other > users folders (delegate) > and to these folders i need to store data. I think it's better to > store hidden item per user's folder > e.g. i have folder AAAAA inside this folder i create hidden item with > user's details, for subfolder > i wouldn't ceate hidden item, cause i can check where i locate in > hierarchy > > > How i set named properties to hidden item via redemption?? > that's what i do: > > .......... > ........ > RDO.RDOFolder rFolder = RdoSession.GetFolderFromID(folderEntryID, > folderStoreID, Type.Missing); > RDO.RDOItems rHiddenItems = rFolder.HiddenItems; > > /*i will identify my hidden item by subject.*/ > > .... i check here if item with such subject already exists > > > rHiddenItem = rFolder.HiddenItems.Add("IPM.Note"); > rHiddenItem.Subject = ... some constant string .....; > rHiddenItem.Save(); > > here i shlould add named properties, how should i add them ?? by help > of > MAPIUtils.HrSetOneProp(rHiddenItem.MAPIOBJECT, > propID, ................. > or there are other posibilities?? and also for get these properties. > > > Thanks in advance. >
|
|
Thanks for replay,
In case i'll use RDOMail.Fields i yet need use the GetIDsFromNames cause i don't know the ProgTag of named property. So it's same like use the MAPIUtils object .
Am i right??
TNX in Advance.
|
|
You *can* use GetIDsFromNames (which RDOMail exposes), but you don't have to - the RDOMail version of fields also takes a DASL property name (string) - in that case Redemption will call GetIDsFromNames internally:
Prop = RDOMail.Fields("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8582000B")
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1178019488.763828.13070[ at ]l77g2000hsb.googlegroups.com...
[Quoted Text] > Thanks for replay, > > In case i'll use RDOMail.Fields i yet need use the GetIDsFromNames > cause i don't know the ProgTag of > named property. So it's same like use the MAPIUtils object . > > Am i right?? > > TNX in Advance. >
|
|
I see, but Dmitry in DASL 8582000B is my PropTag?? Do you mean that i should store it?? I don't inderstand, Also in your samples there are only getters of properties and no setters.
Thanks in Advance.
|
|
Yes, the DASL name includes the GUID and id. Look at a message which has your custom property set with OutlookSpy (url below) - click IMessage, locate the property, look at the DASL edit box on the right hand side of the window. You can hardcode that DASL name in your code. Setting a property is not any different from reading it:
RDOMail.Fields("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8582000B") = SomeBooleanValue
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool
"j" <Evgeny.Br[ at ]gmail.com> wrote in message news:1178089432.279245.87380[ at ]p77g2000hsh.googlegroups.com...
[Quoted Text] > > I see, but Dmitry in DASL 8582000B is my PropTag?? Do you mean that i > should store it?? > I don't inderstand, Also in your samples there are only getters of > properties and no setters. > > > Thanks in Advance. >
|
|
|