How to use GetIDsFromNames(....) method ?

W

Wassim Dagash

Im trying to use the method GetIDsFromNames (C#) but I dont know what
each parameter is for:

int GetIDsFromNames(object MAPIProp, string GUID, object ID, bool
bCreate)

I know waht are GUID and ID but I dont know what the other two
parameters are, Can anyone please help me?
 
D

Dmitry Streblechenko

Is that for Redemption (looks like it judging from the method signature)?
The first parameter is the object (such as MailItem from the Outlook Object
Model). The last parameter allows you to specify whether the mapping must be
created if it's never been used before for the given message store.
E.g. if you specify false, you will get back 0 if the particular combination
of GUID/id has never been used. In most cases, you need to pass true.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
W

Wassim Dagash

Hello Dmitry,
Im trying to use redemption in order to build a ristrict on the
items of outlook calendar.The restriction is simple: getting all
meeting in a range. I tried to use PR_START_DATE and PR_END_DATE
properties for ulPropTag but it seems like not all appointments in OL
calendar got these two properties ( compare by outlook spy), therfore I
tried to use "start" and "end" named properties as ulPropTag , but it
failed cause the name properies should be converted . Im trying to use
GetIDsFromNames inorder to get this convertion. In that case I think
I've some kind of "deadlock" : Im trying to use GetIDsFromNames
inorder to get the item and the function needs the item as parameter.
Do you have any idea how could solve this issue? I'll appreciate your
help.
 
D

Dmitry Streblechenko

You can check that Items.Count > 0 (otherwise there is no point using a
Restriction) and pass the very first item from the folder. Or you can pass
the folder itself - all Redemption cares about is that the object passed as
the first parameter implements a MAPIOBJECT property.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
W

Wassim Dagash

Hello Dimitry,

I tried to use the folder MAPIOBJECT but it seems like
GetIDsFromNames returns different integer than expected (for "start"
named property) , I did the following test:

int n =
mUtils.GetIDsFromNames(calFold.MAPIOBJECT,"{00062002-0000-0000-C000-000000000046}",0x820D,true);

int m = unchecked((int) 0x80320040);


m and n are supposed to be equal but they aren't. Do you have an idea
why it could happen ?
 
W

Wassim Dagash

I also tried to perform a reverse test:

int m = unchecked((int) 0x80320040);
Redemption.NamedProperty np1 =
mUtils.GetNamesFromIDs(calFold.MAPIOBJECT,m);

string s1 = np1.ID.ToString();
int s = Int32.Parse(s1);
int n =
mUtils.GetIDsFromNames(calFold.MAPIOBJECT,"{00062002-0000-0000-C000-000000000046}",s,true);

n supposed to be equal to m but it's not , what Im doing wrong ?
 
D

Dmitry Streblechenko

Did you test it on an item that comes from that folder? What is the
int m = unchecked((int) 0x80320040);
line?

I had no problems with the following script in OutlookSpy (click "Script
Editor", paste the script, click Run):

set mUtils = CreateObject("Redemption.MAPIUtils")
set Folder = Application.ActiveExplorer.CurrentFolder
set Item = Folder.Items(1)
FolderTag = mUtils.GetIDsFromNames(Folder,
"{00062002-0000-0000-C000-000000000046}", &H820D,true) or &H0040
ItemTag = mUtils.GetIDsFromNames(Item,
"{00062002-0000-0000-C000-000000000046}", &H820D,true) or &H0040
MsgBox Hex(FolderTag) & " - " & Hex(ItemTag)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top