I noticed the same problem when trying to set the value of a summary-property
for a file that didn't have any yet.
The only way I have found around this is to manually change the DSOFile.dll
source code provided by the DSOFile-Installer and compile my own version.
If you open up the project and compare
CDsoCustomProperties::GetPropertyFromList to
CDsoSummaryProperties::GetPropertyFromList you will notice that the
CustomProperties one will behave differently depending on wether a previous
item already exists or not.
The SummaryProperties function only works if a previous item exists,
otherwise it throws an E_ACCESSDENIED. I modified
CDsoSummaryProperties::GetPropertyFromList to simply pass NULL as the last
parameter for InitProperty if no previous item exists.
This seems to work for me and had no obvious negative effects, however I
don't know if there was a specific reason for the difference in these
classes, or if it was simply a bug.
This approach might just fix your problem, however I suggest thorough
testing afterwards to make sure it doesn't break anything else that I am not
aware of.
[quoted text, click to view] "mldavis99" wrote:
> The dsofile.dll version 2.0 provided by Microsoft throws an "access denied"
> error whenever all of the Summary Properties are empty "null" and you attempt
> to assign a bstr value to any of them in code.
> Using the source code provided in KB224351 I've been able to trace this to
> the fact that the Summary Propereties Set is added whenever one or more of
> the properties is set in the Windows XP OS and the property set is REMOVED
> when the last of any of the summary properties is removed!!!!
> Note: The code does allow each of these properties to be added as a bstr
> for COM compatibility but the code to automatically add the Summary Property
> Set appears to be incorrectly examining the pointer by testing it directly
> for a NULL...
> Unfortunately I don't have the Win32 experties to correct this in the code
> provided. Can anyone help?????
>
> Thanks, mike :>}
[quoted text, click to view] Gorgoroth wrote:
> CDsoSummaryProperties::GetPropertyFromList to simply pass NULL as the last
> parameter for InitProperty if no previous item exists.
Thanks, Gorgoroth. Looks like a bug to me as well. Not sure why MS
hasn't updated that KB entry. The previous code only worked if you
were modifying a file that already had document summary properties...
That section of code should look similar to the CustomProperties code:
CDsoDocProperty* pchain = NULL;
VARIANT var; var.vt = VT_EMPTY;
// If we are adding item to existing list, append the item...
if (plast) pchain = plast->AppendLink(pitem);
if (FAILED(pitem->InitProperty(NULL, id, &var, TRUE,
pchain)))
ken