Setting Global Object ID for Appointments

M

Mark Cote

Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how to
set (a) binary properties and (b) non-existent properties, both of
which are involved in setting a global ID, from what I understand.

This is my code thus far (error handling removed for readability). I
don't know if the problem is in how I'm setting up the LPSPropValue or
if it's something else altogether.

// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().

LPSPropTagArray lpNamedPropTag = NULL;

// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);

// Set a global ID based on our entry ID.

// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);

// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};

// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);

MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);

LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);

// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);

Thanks,
Mark
 
D

Dmitry Streblechenko

Firstly, you might want to post in teh OUtlook specific newsgroups (e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?

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

Mark Cote said:
Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how to
set (a) binary properties and (b) non-existent properties, both of
which are involved in setting a global ID, from what I understand.

This is my code thus far (error handling removed for readability). I
don't know if the problem is in how I'm setting up the LPSPropValue or
if it's something else altogether.

// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().

LPSPropTagArray lpNamedPropTag = NULL;

// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);

// Set a global ID based on our entry ID.

// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);

// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};

// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);

MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);

LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);

// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);

Thanks,
Mark
 
M

Mark Cote

Firstly, you might want to post in teh OUtlook specific newsgroups (e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?

Sure, I'll post there as well. Only posted here originally because of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.

Pretty sure I'm getting the prop tag properly, as I have successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:

DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23

....

HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;

MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;

// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;

// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;
}

The error I'm getting is invalid argument, so something appears to be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.

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


Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for readability). I
don't know if the problem is in how I'msettingup the LPSPropValue or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
D

Dmitry Streblechenko

Do you set the property type (PT_BINARY) after calling GetIDsFromNames?

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

Mark Cote said:
Firstly, you might want to post in teh OUtlook specific newsgroups (e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?

Sure, I'll post there as well. Only posted here originally because of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.

Pretty sure I'm getting the prop tag properly, as I have successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:

DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23

...

HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;

MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;

// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;

// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;
}

The error I'm getting is invalid argument, so something appears to be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.

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


Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for readability). I
don't know if the problem is in how I'msettingup the LPSPropValue or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
M

Mark Cote

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.

Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:

Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'

My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?

Mark

Do you set the property type (PT_BINARY) after calling GetIDsFromNames?

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


Firstly, you might want to post in teh OUtlook specific newsgroups (e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally because of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23

HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears to be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for readability). I
don't know if the problem is in how I'msettingup the LPSPropValue or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
D

Dmitry Streblechenko

What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do wit
hthis.

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

Mark Cote said:
Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.

Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:

Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'

My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?

Mark

Do you set the property type (PT_BINARY) after calling GetIDsFromNames?

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


Firstly, you might want to post in teh OUtlook specific newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally because of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23

HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears to be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but
I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how
to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for readability).
I
don't know if the problem is in how I'msettingup the LPSPropValue or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry
ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
M

Mark Cote

Okay, yes, it does seem to have something to do with the way I'm
generating IDs. Using Outlook Spy, I copied the global object ID from
an appointment on another machine, and the meeting requests were sent
out fine. But setting the value (again through Outlook Spy) to an
arbitrary value didn't work, even with the 20-byte prefix that you
posted a while ago and which seems common to all global object IDs.
I've experimented a bit but haven't found the pattern yet.

Mark

What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do wit
hthis.

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


Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'
My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?

Do you set the property type (PT_BINARY) after calling GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Firstly, you might want to post in teh OUtlook specific newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally because of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears to be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but
I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how
to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for readability).
I
don't know if the problem is in how I'msettingup the LPSPropValue or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry
ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
M

Mark Cote

Aha, okay, I think I got it. The prefix has to be much longer,
something like this:

040000008200E00074C5B7101A82E00800000000 30E323D6B356
C801000000000000000010000000

There are some bits in the middle that can vary (which I've offset
above), I've noticed, but I think only certain values are permitted.
So it seems that only the last 16 bytes are modifiable, and no more--
the same error occurred if I tried an entry longer than 56 bytes.
This is for Outlook 2002, at least. Anyway not much, but it's
something to work with!

Many thanks,
Mark

What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do wit
hthis.

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


Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'
My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?

Do you set the property type (PT_BINARY) after calling GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Firstly, you might want to post in teh OUtlook specific newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally because of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears to be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but
I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how
to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for readability).
I
don't know if the problem is in how I'msettingup the LPSPropValue or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry
ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
M

Mark Cote

More discoveries! I am no longer sure about the middle bytes have to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just figured
out actually indicate the length of the remaining data, which is why I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.

So my current working hypothesis for the best way to set this value is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such as
10 00 00 00 for 16), followed by that many arbitrary bytes. This is
perfect for my needs.

Mark

What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do wit
hthis.

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


Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'
My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?

Do you set the property type (PT_BINARY) after calling GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Firstly, you might want to post in teh OUtlook specific newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally because of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears to be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002), but
I
cannot get it to work. I am fairly new to MAPI programming and have
not been able to find examples or articles to help me specifically
with this problem; in particular, there is little discussion of how
to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for readability).
I
don't know if the problem is in how I'msettingup the LPSPropValue or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global object
ID.
// This is verified to work for getting global object IDs in Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0, 0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte entry
ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
D

Dmitry Streblechenko

Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted in
this newsgroups: if I remember correctly, the varying field is 8 bytes long
and is the FILETIME when the appointment is created - see the last message
in the following thread:
http://groups.google.com/group/micr...17118ec8b8bf65/096bb36f23c9e6f7?hl=en&lnk=st&

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

Mark Cote said:
More discoveries! I am no longer sure about the middle bytes have to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just figured
out actually indicate the length of the remaining data, which is why I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.

So my current working hypothesis for the best way to set this value is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such as
10 00 00 00 for 16), followed by that many arbitrary bytes. This is
perfect for my needs.

Mark

What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do wit
hthis.

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


Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'
My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?

Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
news:08ca5088-33c7-4bee-8b98-c87fefe478d8@n22g2000prh.googlegroups.com...

On Jan 10, 4:55 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally because
of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have
successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23

HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL,
&lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears to
be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Following some recommendations found in this group, I have
recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002),
but
I
cannot get it to work. I am fairly new to MAPI programming and
have
not been able to find examples or articles to help me
specifically
with this problem; in particular, there is little discussion of
how
to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for
readability).
I
don't know if the problem is in how I'msettingup the LPSPropValue
or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global
object
ID.
// This is verified to work for getting global object IDs in
Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0,
0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte
entry
ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
M

Mark Cote

Aha, well I'm glad to have contributed another discovery vis-a-vis the
length and data fields!

Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?

Mark

Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted in
this newsgroups: if I remember correctly, the varying field is 8 bytes long
and is the FILETIME when the appointment is created - see the last message
in the following thread:http://groups.google.com/group/microsoft.public.win32.programmer.mess...

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


More discoveries! I am no longer sure about the middle bytes have to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just figured
out actually indicate the length of the remaining data, which is why I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this value is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such as
10 00 00 00 for 16), followed by that many arbitrary bytes. This is
perfect for my needs.

What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'
My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?
Mark
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

On Jan 10, 4:55 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally because
of
a couple posts back in 2005 that were exactly about this but with no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have
successfully
used Outlook spy with the returned tag to set the global object ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL,
&lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears to
be
wrong with my lpPropVal. I printed out the contents of lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have
recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set the
global ID property if it is not found (such as in Outlook 2002),
but
I
cannot get it to work. I am fairly new to MAPI programming and
have
not been able to find examples or articles to help me
specifically
with this problem; in particular, there is little discussion of
how
to
set (a) binarypropertiesand (b) non-existentproperties, both of
which are involved insettinga global ID, from what I understand.
This is my code thus far (error handling removed for
readability).
I
don't know if the problem is in how I'msettingup the LPSPropValue
or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global
object
ID.
// This is verified to work for getting global object IDs in
Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0,
0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte
entry
ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
D

Dmitry Streblechenko

Did you set the right type (PT_BOOLEAN)?
How do you open IMessage?

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

Mark Cote said:
Aha, well I'm glad to have contributed another discovery vis-a-vis the
length and data fields!

Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?

Mark

Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted in
this newsgroups: if I remember correctly, the varying field is 8 bytes
long
and is the FILETIME when the appointment is created - see the last
message
in the following
thread:http://groups.google.com/group/microsoft.public.win32.programmer.mess...

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


More discoveries! I am no longer sure about the middle bytes have to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just figured
out actually indicate the length of the remaining data, which is why I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this value is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such as
10 00 00 00 for 16), followed by that many arbitrary bytes. This is
perfect for my needs.

What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do
wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally
got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is
added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'
My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly
fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?

On Jan 10, 5:50 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
news:08ca5088-33c7-4bee-8b98-c87fefe478d8@n22g2000prh.googlegroups.com...

On Jan 10, 4:55 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific
newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally
because
of
a couple posts back in 2005 that were exactly about this but with
no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have
successfully
used Outlook spy with the returned tag to set the global object
ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23

HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL,
&lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears
to
be
wrong with my lpPropVal. I printed out the contents of
lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to
be
okay. I must be missing something but I can't figure out what.

Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Following some recommendations found in this group, I have
recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set
the
global ID property if it is not found (such as in Outlook
2002),
but
I
cannot get it to work. I am fairly new to MAPI programming
and
have
not been able to find examples or articles to help me
specifically
with this problem; in particular, there is little discussion
of
how
to
set (a) binarypropertiesand (b) non-existentproperties, both
of
which are involved insettinga global ID, from what I
understand.
This is my code thus far (error handling removed for
readability).
I
don't know if the problem is in how I'msettingup the
LPSPropValue
or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global
object
ID.
// This is verified to work for getting global object IDs in
Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0,
0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte
entry
ID
lpPropVal->ulPropTag = lpNamedPropTag->aulPropTag[0];
memcpy(lpPropVal->Value.bin.lpb, globalID, 44);
LPSPropProblemArray lppProblems;
lpMsg->SetProps(1, lpPropVal, &lppProblems);
// Cleanup
MAPIFreeBuffer(lpPropVal);
MAPIFreeBuffer(lpNamedPropTag);
Thanks,
Mark
 
M

Mark Cote

Yup, setting type to PT_BOOLEAN. I'm getting the IMessage via
_AppointmentItem::get_MAPIOBJECT(). This works for setting the global
object ID but not for this particular value. A related question: if I
use get_MAPIOBJECT(), do I have to call IMessage::Release() when I'm
finished getting/setting properties?

Here's my code, very similar to my previous excerpt:

LOG4CXX_INFO(logger, "setting invites-sent flag");
HRESULT hr = S_OK;
LPSPropTagArray lpNamedPropTag = NULL;
GetPropTag(lpMsg, lpNamedPropTag, (LPGUID) &PSETID_Appointment,
LID_INVITES_SENT);

ULONG propTag = lpNamedPropTag->aulPropTag[0];
MAPIFreeBuffer(lpNamedPropTag);

LPSPropValue lpPropVal;
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
lpPropVal->Value.b = invitesSent;

lpPropVal->ulPropTag = propTag;
lpPropVal->ulPropTag = CHANGE_PROP_TYPE(lpPropVal->ulPropTag,
PT_BOOLEAN);

// this call fails with E_ACCESSDENIED
lpMsg->SetProps(1, lpPropVal, NULL);

if (SUCCEEDED(hr))
{
hr = lpMsg->SaveChanges(0);
}

MAPIFreeBuffer(lpPropVal);



The function GetPropTag is as follows:

HRESULT GetPropTag(LPMESSAGE lpMsg, LPSPropTagArray &lpNamedPropTag,
LPGUID guid, LONG id)
{
HRESULT hr = S_OK;

MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;

// Set up the request to GetIDsFromNames.
NamedID.lpguid = guid;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = id;
lpNamedID = &NamedID;

// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);

return hr;
}


Mark


Did you set the right type (PT_BOOLEAN)?
How do you open IMessage?

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


Aha, well I'm glad to have contributed another discovery vis-a-vis the
length and data fields!
Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?

Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted in
this newsgroups: if I remember correctly, the varying field is 8 bytes
long
and is the FILETIME when the appointment is created - see the last
message
in the following
thread:http://groups.google.com/group/microsoft.public.win32.programmer..mess...
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

More discoveries! I am no longer sure about the middle bytes have to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just figured
out actually indicate the length of the remaining data, which is why I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this value is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such as
10 00 00 00 for 16), followed by that many arbitrary bytes. This is
perfect for my needs.
Mark
What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do
wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally
got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is
added
to a meeting request that formerly had no recipients. The original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection or
modem.'
My network connection is fine, and this only occurs after that exact
series of steps. Adding recipients while creating a meeting request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly
fine
network connections. It is somehow related to my setting the global
IDs. Very strange. Any ideas?
Mark
On Jan 10, 5:50 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

On Jan 10, 4:55 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific
newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally
because
of
a couple posts back in 2005 that were exactly about this but with
no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have
successfully
used Outlook spy with the returned tag to set the global object
ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg, LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL,
&lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears
to
be
wrong with my lpPropVal. I printed out the contents of
lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem to
be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have
recently
implemented a system to index appointments based on global IDs
instead
of entry IDs. I am now attempting to write some code to set
the
global ID property if it is not found (such as in Outlook
2002),
but
I
cannot get it to work. I am fairly new to MAPI programming
and
have
not been able to find examples or articles to help me
specifically
with this problem; in particular, there is little discussion
of
how
to
set (a) binarypropertiesand (b) non-existentproperties, both
of
which are involved insettinga global ID, from what I
understand.
This is my code thus far (error handling removed for
readability).
I
don't know if the problem is in how I'msettingup the
LPSPropValue
or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the global
object
ID.
// This is verified to work for getting global object IDs in
Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00, 0xE0,
0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID *)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte
entry
ID

...

read more »
 
D

Dmitry Streblechenko

Did you previously call SaveChanges(0)? Firstly, use KEEP_OPEN_READWRITE
instead of 0. Secondly, you are not supposed to call IMessage::SaveChanges
if you retrieved IMessage from the MAPIOBJECT property. Saving the chnages
is Outlook's prerogative, even if sometime you need to convince Outlook that
something has changed; resetting teh Subject property woudl do.
Thirdly, yes, you need to release IMessage retrieved from the MAPIOBJECT
property.

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

Yup, setting type to PT_BOOLEAN. I'm getting the IMessage via
_AppointmentItem::get_MAPIOBJECT(). This works for setting the global
object ID but not for this particular value. A related question: if I
use get_MAPIOBJECT(), do I have to call IMessage::Release() when I'm
finished getting/setting properties?

Here's my code, very similar to my previous excerpt:

LOG4CXX_INFO(logger, "setting invites-sent flag");
HRESULT hr = S_OK;
LPSPropTagArray lpNamedPropTag = NULL;
GetPropTag(lpMsg, lpNamedPropTag, (LPGUID) &PSETID_Appointment,
LID_INVITES_SENT);

ULONG propTag = lpNamedPropTag->aulPropTag[0];
MAPIFreeBuffer(lpNamedPropTag);

LPSPropValue lpPropVal;
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
lpPropVal->Value.b = invitesSent;

lpPropVal->ulPropTag = propTag;
lpPropVal->ulPropTag = CHANGE_PROP_TYPE(lpPropVal->ulPropTag,
PT_BOOLEAN);

// this call fails with E_ACCESSDENIED
lpMsg->SetProps(1, lpPropVal, NULL);

if (SUCCEEDED(hr))
{
hr = lpMsg->SaveChanges(0);
}

MAPIFreeBuffer(lpPropVal);



The function GetPropTag is as follows:

HRESULT GetPropTag(LPMESSAGE lpMsg, LPSPropTagArray &lpNamedPropTag,
LPGUID guid, LONG id)
{
HRESULT hr = S_OK;

MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;

// Set up the request to GetIDsFromNames.
NamedID.lpguid = guid;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = id;
lpNamedID = &NamedID;

// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);

return hr;
}


Mark


Did you set the right type (PT_BOOLEAN)?
How do you open IMessage?

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


Aha, well I'm glad to have contributed another discovery vis-a-vis the
length and data fields!
Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?

Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted
in
this newsgroups: if I remember correctly, the varying field is 8 bytes
long
and is the FILETIME when the appointment is created - see the last
message
in the following
thread:http://groups.google.com/group/microsoft.public.win32.programmer.mess...
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

More discoveries! I am no longer sure about the middle bytes have to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just
figured
out actually indicate the length of the remaining data, which is why
I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this value
is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such
as
10 00 00 00 for 16), followed by that many arbitrary bytes. This is
perfect for my needs.
Mark
On Jan 12, 6:35 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do
wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally
got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is
added
to a meeting request that formerly had no recipients. The
original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection
or
modem.'
My network connection is fine, and this only occurs after that
exact
series of steps. Adding recipients while creating a meeting
request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly
fine
network connections. It is somehow related to my setting the
global
IDs. Very strange. Any ideas?
Mark
On Jan 10, 5:50 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

On Jan 10, 4:55 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific
newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally
because
of
a couple posts back in 2005 that were exactly about this but
with
no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have
successfully
used Outlook spy with the returned tag to set the global object
ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg,
LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL,
&lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears
to
be
wrong with my lpPropVal. I printed out the contents of
lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem
to
be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have
recently
implemented a system to index appointments based on global
IDs
instead
of entry IDs. I am now attempting to write some code to set
the
global ID property if it is not found (such as in Outlook
2002),
but
I
cannot get it to work. I am fairly new to MAPI programming
and
have
not been able to find examples or articles to help me
specifically
with this problem; in particular, there is little discussion
of
how
to
set (a) binarypropertiesand (b) non-existentproperties, both
of
which are involved insettinga global ID, from what I
understand.
This is my code thus far (error handling removed for
readability).
I
don't know if the problem is in how I'msettingup the
LPSPropValue
or
if it's something else altogether.
// lpMsg (used below) is an IMessage obtained
// from Outlook::_AppointmentItem::get_MAPIOBJECT().
LPSPropTagArray lpNamedPropTag = NULL;
// This function sets lpNamedPropTag to the tag of the
global
object
ID.
// This is verified to work for getting global object IDs in
Outlook
2003 and 2007.
GetGlobalObjectIdPropTag(lpMsg, lpNamedPropTag);
// Set a global ID based on our entry ID.
// Get Entry ID.
ULONG ulVal = 0;
LPSPropValue lpPropVal = NULL;
SPropTagArray lpPropTagArray;
lpPropTagArray.cValues = 1;
lpPropTagArray.aulPropTag[0] = PR_ENTRYID;
lpMsg->GetProps(&lpPropTagArray, 0, &ulVal, &lpPropVal);
// Prefix for global ID.
BYTE globalID[44] = {0x04, 0x00, 0x00, 0x00, 0x82, 0x00,
0xE0,
0x00,
0x74, 0xC5,
0xB7, 0x10, 0x1A, 0x82, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00};
// Use entry ID as unique identifier after prefix.
memcpy(&globalID[20], lpPropVal->Value.bin.lpb, 24);
MAPIFreeBuffer(lpPropVal);
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID
*)&lpPropVal);
MAPIAllocateMore(44, (LPVOID)lpPropVal, (LPVOID
*)&lpPropVal-
Value.bin.lpb);
lpPropVal->Value.bin.cb = 44; // 20-byte prefix plus 24-byte
entry
ID

...

read more »
 
M

Mark Cote

In this case we're creating an appointment, and I call
_AppointmentItem::Save(), then I execute the code I posted, after
calling _AppointmentItem::get_MAPIOBJECT() on the same
_AppointmentItem (which is okay, right? I assume _AppointmentItem
stays valid once I call Save()--it seems to be valid for setting the
global object ID afterwards).

As for not calling SaveChanges(), I can't get this to work. I've had
no problems calling SaveChanges() on the IMessages so far, but not
calling it results in the new global object ID not sticking. I tried
taking out the SaveChanges() call and instead resetting the subject
with this, but to no avail:

// Force a save.
BSTR subject;
hr = _item->get_Subject(&subject);
if (SUCCEEDED(hr))
{
_bstr_t blank("");
BSTR blanktmp = blank.copy();
_item->put_Subject(blanktmp);
_item->put_Subject(subject);
}

Also, I imagine I should also call IMessage::Release() if I obtain an
LPMESSAGE from IMAPIFolder::OpenEntry(), correct?

I will try some of your recommendations vis-a-vis the invites-sent
flag soon.

By the way, many thanks for all your help. I am incredibly grateful;
people like you keep my faith in humanity alive and well! :)

Mark

Did you previously call SaveChanges(0)? Firstly, use KEEP_OPEN_READWRITE
instead of 0. Secondly, you are not supposed to call IMessage::SaveChanges
if you retrieved IMessage from the MAPIOBJECT property. Saving the chnages
is Outlook's prerogative, even if sometime you need to convince Outlook that
something has changed; resetting teh Subject property woudl do.
Thirdly, yes, you need to release IMessage retrieved from the MAPIOBJECT
property.

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


Yup, setting type to PT_BOOLEAN. I'm getting the IMessage via
_AppointmentItem::get_MAPIOBJECT(). This works for setting the global
object ID but not for this particular value. A related question: if I
use get_MAPIOBJECT(), do I have to call IMessage::Release() when I'm
finished getting/setting properties?

Here's my code, very similar to my previous excerpt:

LOG4CXX_INFO(logger, "setting invites-sent flag");
HRESULT hr = S_OK;
LPSPropTagArray lpNamedPropTag = NULL;
GetPropTag(lpMsg, lpNamedPropTag, (LPGUID) &PSETID_Appointment,
LID_INVITES_SENT);

ULONG propTag = lpNamedPropTag->aulPropTag[0];
MAPIFreeBuffer(lpNamedPropTag);

LPSPropValue lpPropVal;
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
lpPropVal->Value.b = invitesSent;

lpPropVal->ulPropTag = propTag;
lpPropVal->ulPropTag = CHANGE_PROP_TYPE(lpPropVal->ulPropTag,
PT_BOOLEAN);

// this call fails with E_ACCESSDENIED
lpMsg->SetProps(1, lpPropVal, NULL);

if (SUCCEEDED(hr))
{
hr = lpMsg->SaveChanges(0);

}

MAPIFreeBuffer(lpPropVal);

The function GetPropTag is as follows:

HRESULT GetPropTag(LPMESSAGE lpMsg, LPSPropTagArray &lpNamedPropTag,
LPGUID guid, LONG id)
{
HRESULT hr = S_OK;

MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;

// Set up the request to GetIDsFromNames.
NamedID.lpguid = guid;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = id;
lpNamedID = &NamedID;

// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);

return hr;

}

Mark

Did you set the right type (PT_BOOLEAN)?
How do you open IMessage?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
news:1ef3df80-9fba-4630-86a5-49f4ad0586c7@q39g2000hsf.googlegroups.com...
Aha, well I'm glad to have contributed another discovery vis-a-vis the
length and data fields!
Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?
Mark
Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted
in
this newsgroups: if I remember correctly, the varying field is 8 bytes
long
and is the FILETIME when the appointment is created - see the last
message
in the following
thread:http://groups.google.com/group/microsoft.public.win32.programmer.mess...
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

More discoveries! I am no longer sure about the middle bytes have to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just
figured
out actually indicate the length of the remaining data, which is why
I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this value
is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such
as
10 00 00 00 for 16), followed by that many arbitrary bytes. This is
perfect for my needs.
Mark
On Jan 12, 6:35 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to do
wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I originally
got
the tag. I have now verified that, after setting the 0x23 and 0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is
added
to a meeting request that formerly had no recipients. The
original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network connection
or
modem.'
My network connection is fine, and this only occurs after that
exact
series of steps. Adding recipients while creating a meeting
request
does not trigger this error. I have done some cursory research on
this error, and it happens to a lot of people who have perfectly
fine
network connections. It is somehow related to my setting the
global
IDs. Very strange. Any ideas?
Mark
On Jan 10, 5:50 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

On Jan 10, 4:55 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific
newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally
because
of
a couple posts back in 2005 that were exactly about this but
with
no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have
successfully
used Outlook spy with the returned tag to set the global object
ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg,
LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL,
&lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something appears
to
be
wrong with my lpPropVal. I printed out the contents of
lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem
to
be
okay. I must be missing something but I can't figure out what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have
recently
implemented a system to index appointments based on global
IDs

...

read more »
 
D

Dmitry Streblechenko

After taking out the calls to IMessage::SaveChanges, you need to set the
MAPI properties, reset the Subject, *then* call AppointmentItem.Save.

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

In this case we're creating an appointment, and I call
_AppointmentItem::Save(), then I execute the code I posted, after
calling _AppointmentItem::get_MAPIOBJECT() on the same
_AppointmentItem (which is okay, right? I assume _AppointmentItem
stays valid once I call Save()--it seems to be valid for setting the
global object ID afterwards).

As for not calling SaveChanges(), I can't get this to work. I've had
no problems calling SaveChanges() on the IMessages so far, but not
calling it results in the new global object ID not sticking. I tried
taking out the SaveChanges() call and instead resetting the subject
with this, but to no avail:

// Force a save.
BSTR subject;
hr = _item->get_Subject(&subject);
if (SUCCEEDED(hr))
{
_bstr_t blank("");
BSTR blanktmp = blank.copy();
_item->put_Subject(blanktmp);
_item->put_Subject(subject);
}

Also, I imagine I should also call IMessage::Release() if I obtain an
LPMESSAGE from IMAPIFolder::OpenEntry(), correct?

I will try some of your recommendations vis-a-vis the invites-sent
flag soon.

By the way, many thanks for all your help. I am incredibly grateful;
people like you keep my faith in humanity alive and well! :)

Mark

Did you previously call SaveChanges(0)? Firstly, use KEEP_OPEN_READWRITE
instead of 0. Secondly, you are not supposed to call IMessage::SaveChanges
if you retrieved IMessage from the MAPIOBJECT property. Saving the chnages
is Outlook's prerogative, even if sometime you need to convince Outlook
that
something has changed; resetting teh Subject property woudl do.
Thirdly, yes, you need to release IMessage retrieved from the MAPIOBJECT
property.

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


Yup, setting type to PT_BOOLEAN. I'm getting the IMessage via
_AppointmentItem::get_MAPIOBJECT(). This works for setting the global
object ID but not for this particular value. A related question: if I
use get_MAPIOBJECT(), do I have to call IMessage::Release() when I'm
finished getting/setting properties?

Here's my code, very similar to my previous excerpt:

LOG4CXX_INFO(logger, "setting invites-sent flag");
HRESULT hr = S_OK;
LPSPropTagArray lpNamedPropTag = NULL;
GetPropTag(lpMsg, lpNamedPropTag, (LPGUID) &PSETID_Appointment,
LID_INVITES_SENT);

ULONG propTag = lpNamedPropTag->aulPropTag[0];
MAPIFreeBuffer(lpNamedPropTag);

LPSPropValue lpPropVal;
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
lpPropVal->Value.b = invitesSent;

lpPropVal->ulPropTag = propTag;
lpPropVal->ulPropTag = CHANGE_PROP_TYPE(lpPropVal->ulPropTag,
PT_BOOLEAN);

// this call fails with E_ACCESSDENIED
lpMsg->SetProps(1, lpPropVal, NULL);

if (SUCCEEDED(hr))
{
hr = lpMsg->SaveChanges(0);

}

MAPIFreeBuffer(lpPropVal);

The function GetPropTag is as follows:

HRESULT GetPropTag(LPMESSAGE lpMsg, LPSPropTagArray &lpNamedPropTag,
LPGUID guid, LONG id)
{
HRESULT hr = S_OK;

MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;

// Set up the request to GetIDsFromNames.
NamedID.lpguid = guid;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = id;
lpNamedID = &NamedID;

// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);

return hr;

}

Mark

Did you set the right type (PT_BOOLEAN)?
How do you open IMessage?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
news:1ef3df80-9fba-4630-86a5-49f4ad0586c7@q39g2000hsf.googlegroups.com...
Aha, well I'm glad to have contributed another discovery vis-a-vis the
length and data fields!
Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?
Mark
Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted
in
this newsgroups: if I remember correctly, the varying field is 8
bytes
long
and is the FILETIME when the appointment is created - see the last
message
in the following
thread:http://groups.google.com/group/microsoft.public.win32.programmer.mess...
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

More discoveries! I am no longer sure about the middle bytes have
to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just
figured
out actually indicate the length of the remaining data, which is
why
I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this value
is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such
as
10 00 00 00 for 16), followed by that many arbitrary bytes. This
is
perfect for my needs.
Mark
On Jan 12, 6:35 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to
do
wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I
originally
got
the tag. I have now verified that, after setting the 0x23 and
0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm
not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is
added
to a meeting request that formerly had no recipients. The
original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network
connection
or
modem.'
My network connection is fine, and this only occurs after that
exact
series of steps. Adding recipients while creating a meeting
request
does not trigger this error. I have done some cursory research
on
this error, and it happens to a lot of people who have perfectly
fine
network connections. It is somehow related to my setting the
global
IDs. Very strange. Any ideas?
Mark
On Jan 10, 5:50 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

On Jan 10, 4:55 pm, "Dmitry Streblechenko"
<[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific
newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally
because
of
a couple posts back in 2005 that were exactly about this but
with
no
code, tantalizingly close to what I need.
Pretty sure I'm getting the prop tag properly, as I have
successfully
used Outlook spy with the returned tag to set the global
object
ID,
but here's exactly what I'm doing:
DEFINE_GUID(PSETID_Meeting,
0x6ED8DA90,0x450B,0x101B,0x98,0xDA,0x00,0xAA,0x00,0x3F,0x13,0x05);
#define LID_GLOBAL_OBJID 0x23
...
HRESULT GetGlobalObjectIdPropTag(LPMESSAGE lpMsg,
LPSPropTagArray
&lpNamedPropTag)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = (LPGUID) &PSETID_Meeting;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = LID_GLOBAL_OBJID;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL,
&lpNamedPropTag);
return hr;
}
The error I'm getting is invalid argument, so something
appears
to
be
wrong with my lpPropVal. I printed out the contents of
lpPropVal-
ulPropTag, ->Value.bin.cb, and ->Value.bin.lpb, and they seem
to
be
okay. I must be missing something but I can't figure out
what.
Thanks,
Mark
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Following some recommendations found in this group, I have
recently
implemented a system to index appointments based on global
IDs

...

read more »
 
M

Mark Cote

Aha, okay, that worked for the global object ID, but I still can't set
property 0x8229. No errors are generated this time, but the value
obstinately refuses to change to true. I've confirmed that it is
getting the proper tag. I'm calling CHANGE_PROP_TYPE() on the tag
with the argument PT_BOOLEAN, I've allocated the memory for an
LPSPropValue, and assigned a value of 1 to the LPSPropValue's
Value.bin. What else could I be missing?

Mark

After taking out the calls to IMessage::SaveChanges, you need to set the
MAPI properties, reset the Subject, *then* call AppointmentItem.Save.

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


In this case we're creating an appointment, and I call
_AppointmentItem::Save(), then I execute the code I posted, after
calling _AppointmentItem::get_MAPIOBJECT() on the same
_AppointmentItem (which is okay, right? I assume _AppointmentItem
stays valid once I call Save()--it seems to be valid for setting the
global object ID afterwards).

As for not calling SaveChanges(), I can't get this to work. I've had
no problems calling SaveChanges() on the IMessages so far, but not
calling it results in the new global object ID not sticking. I tried
taking out the SaveChanges() call and instead resetting the subject
with this, but to no avail:

// Force a save.
BSTR subject;
hr = _item->get_Subject(&subject);
if (SUCCEEDED(hr))
{
_bstr_t blank("");
BSTR blanktmp = blank.copy();
_item->put_Subject(blanktmp);
_item->put_Subject(subject);

}

Also, I imagine I should also call IMessage::Release() if I obtain an
LPMESSAGE from IMAPIFolder::OpenEntry(), correct?

I will try some of your recommendations vis-a-vis the invites-sent
flag soon.

By the way, many thanks for all your help. I am incredibly grateful;
people like you keep my faith in humanity alive and well! :)

Mark

Did you previously call SaveChanges(0)? Firstly, use KEEP_OPEN_READWRITE
instead of 0. Secondly, you are not supposed to call IMessage::SaveChanges
if you retrieved IMessage from the MAPIOBJECT property. Saving the chnages
is Outlook's prerogative, even if sometime you need to convince Outlook
that
something has changed; resetting teh Subject property woudl do.
Thirdly, yes, you need to release IMessage retrieved from the MAPIOBJECT
property.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Mark Cote" <[email protected]> wrote in message
Yup, setting type to PT_BOOLEAN. I'm getting the IMessage via
_AppointmentItem::get_MAPIOBJECT(). This works for setting the global
object ID but not for this particular value. A related question: if I
use get_MAPIOBJECT(), do I have to call IMessage::Release() when I'm
finished getting/setting properties?
Here's my code, very similar to my previous excerpt:
LOG4CXX_INFO(logger, "setting invites-sent flag");
HRESULT hr = S_OK;
LPSPropTagArray lpNamedPropTag = NULL;
GetPropTag(lpMsg, lpNamedPropTag, (LPGUID) &PSETID_Appointment,
LID_INVITES_SENT);
ULONG propTag = lpNamedPropTag->aulPropTag[0];
MAPIFreeBuffer(lpNamedPropTag);
LPSPropValue lpPropVal;
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
lpPropVal->Value.b = invitesSent;
lpPropVal->ulPropTag = propTag;
lpPropVal->ulPropTag = CHANGE_PROP_TYPE(lpPropVal->ulPropTag,
PT_BOOLEAN);
// this call fails with E_ACCESSDENIED
lpMsg->SetProps(1, lpPropVal, NULL);
if (SUCCEEDED(hr))
{
hr = lpMsg->SaveChanges(0);


The function GetPropTag is as follows:
HRESULT GetPropTag(LPMESSAGE lpMsg, LPSPropTagArray &lpNamedPropTag,
LPGUID guid, LONG id)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = guid;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = id;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;

Did you set the right type (PT_BOOLEAN)?
How do you open IMessage?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha, well I'm glad to have contributed another discovery vis-a-vis the
length and data fields!
Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?
Mark
Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were posted
in
this newsgroups: if I remember correctly, the varying field is 8
bytes
long
and is the FILETIME when the appointment is created - see the last
message
in the following
thread:http://groups.google.com/group/microsoft.public.win32.programmer.mess...
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

More discoveries! I am no longer sure about the middle bytes have
to
be a set pattern... I just saw a global object ID which was all 0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just
figured
out actually indicate the length of the remaining data, which is
why
I
was only able to set 56-byte values earlier--I was leaving the 0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this value
is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0 08,
followed by 20 0-bytes, followed by a 4-byte length indicator (such
as
10 00 00 00 for 16), followed by that many arbitrary bytes. This
is
perfect for my needs.
Mark
On Jan 12, 6:35 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything to
do
wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I
originally
got
the tag. I have now verified that, after setting the 0x23 and
0x3
properties on a meeting request that has no recipients, they are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm
not
sure exactly what is happening, and I'm still investigating, but
Outlook is unable to send out any messages after a recipient is
added
to a meeting request that formerly had no recipients. The
original
mail fails to send as do any updates; I get the following error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13) :
'Unable to connect to the network. Check your network
connection
or
modem.'
My network connection is fine, and this only occurs after that
exact
series of steps. Adding recipients while creating a meeting
request
does not trigger this error. I have done some cursory research
on
this error, and it happens to a lot of people who have perfectly
fine
network connections. It is somehow related to my setting the
global
IDs. Very strange. Any ideas?
Mark
On Jan 10, 5:50 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

On Jan 10, 4:55 pm, "Dmitry Streblechenko"
<[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific
newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally
because
of
a couple posts back in 2005 that were exactly about this but
with
no

...

read more »
 
D

Dmitry Streblechenko

How exactly doyou populate the corresponding SPropValue structure? Do you
set SPropValue.Value.b to 0/1 or some other value (such as 0xFFFFFFFF)?

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

Aha, okay, that worked for the global object ID, but I still can't set
property 0x8229. No errors are generated this time, but the value
obstinately refuses to change to true. I've confirmed that it is
getting the proper tag. I'm calling CHANGE_PROP_TYPE() on the tag
with the argument PT_BOOLEAN, I've allocated the memory for an
LPSPropValue, and assigned a value of 1 to the LPSPropValue's
Value.bin. What else could I be missing?

Mark

After taking out the calls to IMessage::SaveChanges, you need to set the
MAPI properties, reset the Subject, *then* call AppointmentItem.Save.

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


In this case we're creating an appointment, and I call
_AppointmentItem::Save(), then I execute the code I posted, after
calling _AppointmentItem::get_MAPIOBJECT() on the same
_AppointmentItem (which is okay, right? I assume _AppointmentItem
stays valid once I call Save()--it seems to be valid for setting the
global object ID afterwards).

As for not calling SaveChanges(), I can't get this to work. I've had
no problems calling SaveChanges() on the IMessages so far, but not
calling it results in the new global object ID not sticking. I tried
taking out the SaveChanges() call and instead resetting the subject
with this, but to no avail:

// Force a save.
BSTR subject;
hr = _item->get_Subject(&subject);
if (SUCCEEDED(hr))
{
_bstr_t blank("");
BSTR blanktmp = blank.copy();
_item->put_Subject(blanktmp);
_item->put_Subject(subject);

}

Also, I imagine I should also call IMessage::Release() if I obtain an
LPMESSAGE from IMAPIFolder::OpenEntry(), correct?

I will try some of your recommendations vis-a-vis the invites-sent
flag soon.

By the way, many thanks for all your help. I am incredibly grateful;
people like you keep my faith in humanity alive and well! :)

Mark

Did you previously call SaveChanges(0)? Firstly, use KEEP_OPEN_READWRITE
instead of 0. Secondly, you are not supposed to call
IMessage::SaveChanges
if you retrieved IMessage from the MAPIOBJECT property. Saving the
chnages
is Outlook's prerogative, even if sometime you need to convince Outlook
that
something has changed; resetting teh Subject property woudl do.
Thirdly, yes, you need to release IMessage retrieved from the MAPIOBJECT
property.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Mark Cote" <[email protected]> wrote in message
Yup, setting type to PT_BOOLEAN. I'm getting the IMessage via
_AppointmentItem::get_MAPIOBJECT(). This works for setting the global
object ID but not for this particular value. A related question: if I
use get_MAPIOBJECT(), do I have to call IMessage::Release() when I'm
finished getting/setting properties?
Here's my code, very similar to my previous excerpt:
LOG4CXX_INFO(logger, "setting invites-sent flag");
HRESULT hr = S_OK;
LPSPropTagArray lpNamedPropTag = NULL;
GetPropTag(lpMsg, lpNamedPropTag, (LPGUID) &PSETID_Appointment,
LID_INVITES_SENT);
ULONG propTag = lpNamedPropTag->aulPropTag[0];
MAPIFreeBuffer(lpNamedPropTag);
LPSPropValue lpPropVal;
MAPIAllocateBuffer(sizeof(SPropValue), (LPVOID *)&lpPropVal);
lpPropVal->Value.b = invitesSent;
lpPropVal->ulPropTag = propTag;
lpPropVal->ulPropTag = CHANGE_PROP_TYPE(lpPropVal->ulPropTag,
PT_BOOLEAN);
// this call fails with E_ACCESSDENIED
lpMsg->SetProps(1, lpPropVal, NULL);
if (SUCCEEDED(hr))
{
hr = lpMsg->SaveChanges(0);


The function GetPropTag is as follows:
HRESULT GetPropTag(LPMESSAGE lpMsg, LPSPropTagArray &lpNamedPropTag,
LPGUID guid, LONG id)
{
HRESULT hr = S_OK;
MAPINAMEID NamedID = {0};
LPMAPINAMEID lpNamedID = NULL;
// Set up the request to GetIDsFromNames.
NamedID.lpguid = guid;
NamedID.ulKind = MNID_ID;
NamedID.Kind.lID = id;
lpNamedID = &NamedID;
// Find the prop tag
hr = lpMsg->GetIDsFromNames(1, &lpNamedID, NULL, &lpNamedPropTag);
return hr;

Did you set the right type (PT_BOOLEAN)?
How do you open IMessage?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha, well I'm glad to have contributed another discovery vis-a-vis
the
length and data fields!
Quick question: there's a property I'm trying to set (IID 0x8229--
appears to represent whether or not invites have been sent), but I
get
an E_ACCESS_DENIED error (0x80070005). I've read that some MAPI
values are read-only, so I'm not too surprised. However, I was able
to change the value in Outlook Spy. What is Outlook Spy doing that
allows it to write to such a property?
Mark
On Jan 14, 6:19 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
Oh, wait! I thought you meant task ids.
Appointment ids were hacked some time ago and the results were
posted
in
this newsgroups: if I remember correctly, the varying field is 8
bytes
long
and is the FILETIME when the appointment is created - see the last
message
in the following
thread:http://groups.google.com/group/microsoft.public.win32.programmer.mess...
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

More discoveries! I am no longer sure about the middle bytes
have
to
be a set pattern... I just saw a global object ID which was all
0s
from byte 17 to byte 36, inclusive. My test values may not have
worked because of other values, like bytes 37-40, which I just
figured
out actually indicate the length of the remaining data, which is
why
I
was only able to set 56-byte values earlier--I was leaving the
0x10
alone, meaning only 16 bytes could follow.
So my current working hypothesis for the best way to set this
value
is
the 16-byte prefix 04 00 00 00 82 00 E0 00 74 C5 B7 10 1A 82 E0
08,
followed by 20 0-bytes, followed by a 4-byte length indicator
(such
as
10 00 00 00 for 16), followed by that many arbitrary bytes. This
is
perfect for my needs.
Mark
On Jan 12, 6:35 pm, "Dmitry Streblechenko" <[email protected]>
wrote:
What happens if you set the value id to one of the existing ids?
I am just curious if the contenst of your new id have anything
to
do
wit
hthis.
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Aha! That was it. I didn't realize I would have to call
CHANGE_PROP_TYPE() again, since I had called it when I
originally
got
the tag. I have now verified that, after setting the 0x23 and
0x3
properties on a meeting request that has no recipients, they
are
retained after I add recipients, while the entry ID changes.
Unfortunately I got a new, completely different problems. I'm
not
sure exactly what is happening, and I'm still investigating,
but
Outlook is unable to send out any messages after a recipient
is
added
to a meeting request that formerly had no recipients. The
original
mail fails to send as do any updates; I get the following
error:
Task 'pop.gmail.com - Sending' reported error (0x800CCC13)
:
'Unable to connect to the network. Check your network
connection
or
modem.'
My network connection is fine, and this only occurs after that
exact
series of steps. Adding recipients while creating a meeting
request
does not trigger this error. I have done some cursory
research
on
this error, and it happens to a lot of people who have
perfectly
fine
network connections. It is somehow related to my setting the
global
IDs. Very strange. Any ideas?
Mark
On Jan 10, 5:50 pm, "Dmitry Streblechenko"
<[email protected]>
wrote:
Do you set the property type (PT_BINARY) after calling
GetIDsFromNames?
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

On Jan 10, 4:55 pm, "Dmitry Streblechenko"
<[email protected]>
wrote:
Firstly, you might want to post in teh OUtlook specific
newsgroups
(e.g.
developer.outlook.addins) or, event better, a MAPI
specific
newsgroup
(win32.programmer.messaging)
Secondly, how do you retrieve the value of
lpNamedPropTag->aulPropTag[0]?
What does SetProps() returns?
Sure, I'll post there as well. Only posted here originally
because
of
a couple posts back in 2005 that were exactly about this
but
with
no

...

read more »
 
Top