G
GordonS
I have an Outlook 2007 add-in built using C# and Visual Studio 2008 that
presents a custom form region for editing Contacts.
These contacts have custom properties that are set using Exchange Web
Services from another application, but must be read and written to using
Outlook 2007. The application that exports the contacts to exchange creates
custom properties for extra fields supported by our web client application.
Contacts are exported to a public folder. We are using Exchange 2007 SP1
on the server and both the clients are running Office 2007 on Vista.
The good news is that on some PCs the add-in works fine – it can read and
write the extended custom properties set in Exchange. However, on one test
PC we are getting the following error when trying to read any of our extended
properties:
Exception reading property 'DIWOR' = System.UnauthorizedAccessException: The
property
"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/DIWOR" does not support this operation.
at
Microsoft.Office.Interop.Outlook.PropertyAccessorClass.GetProperty(String
SchemaName)
at
Pilgrim.Office.Outlook.Contact.SDO.ContactDetailsClient.GetMAPIProperty(PropertyAccessor objPA, String sPropertyName)
It should be noted that the exception is only thrown when trying to read
extended properties of a Contact using the method below – reading the
standard properties does not cause a problem.
The code for the GetMAPIProperty() method is as follows:
public static string GetMAPIProperty(MSOutlook.PropertyAccessor
objPA, string sPropertyName)
{
string sValue, sErrorMessage;
sValue = String.Empty;
try
{
object objProperty =
objPA.GetProperty("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/" + sPropertyName);
if (objProperty != null)
{
sValue = objProperty.ToString();
}
}
catch (Exception ex)
{
<code to log error goes here>
}
....
}
The code to set a MAPI property is much the same:
public static string GetMAPITag(MSOutlook.PropertyAccessor objPA,
string sTagName)
{
try
{
object objProperty =
objPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/" + sTagName);
if (objProperty != null)
{
return objProperty.ToString();
}
else
{
return "";
}
}
catch
{
return "";
}
}
We tried granting Owner privileges to the Anonymous and Default users on the
folder, but as soon as you create a new contact in one of these folders you
can’t read it because of the above exception!
Any help would be greatly recieved
presents a custom form region for editing Contacts.
These contacts have custom properties that are set using Exchange Web
Services from another application, but must be read and written to using
Outlook 2007. The application that exports the contacts to exchange creates
custom properties for extra fields supported by our web client application.
Contacts are exported to a public folder. We are using Exchange 2007 SP1
on the server and both the clients are running Office 2007 on Vista.
The good news is that on some PCs the add-in works fine – it can read and
write the extended custom properties set in Exchange. However, on one test
PC we are getting the following error when trying to read any of our extended
properties:
Exception reading property 'DIWOR' = System.UnauthorizedAccessException: The
property
"http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/DIWOR" does not support this operation.
at
Microsoft.Office.Interop.Outlook.PropertyAccessorClass.GetProperty(String
SchemaName)
at
Pilgrim.Office.Outlook.Contact.SDO.ContactDetailsClient.GetMAPIProperty(PropertyAccessor objPA, String sPropertyName)
It should be noted that the exception is only thrown when trying to read
extended properties of a Contact using the method below – reading the
standard properties does not cause a problem.
The code for the GetMAPIProperty() method is as follows:
public static string GetMAPIProperty(MSOutlook.PropertyAccessor
objPA, string sPropertyName)
{
string sValue, sErrorMessage;
sValue = String.Empty;
try
{
object objProperty =
objPA.GetProperty("http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/" + sPropertyName);
if (objProperty != null)
{
sValue = objProperty.ToString();
}
}
catch (Exception ex)
{
<code to log error goes here>
}
....
}
The code to set a MAPI property is much the same:
public static string GetMAPITag(MSOutlook.PropertyAccessor objPA,
string sTagName)
{
try
{
object objProperty =
objPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/" + sTagName);
if (objProperty != null)
{
return objProperty.ToString();
}
else
{
return "";
}
}
catch
{
return "";
}
}
We tried granting Owner privileges to the Anonymous and Default users on the
folder, but as soon as you create a new contact in one of these folders you
can’t read it because of the above exception!
Any help would be greatly recieved