Hi, I'm having a weird problem when using Content Management API 2007 to enumerate vaults particular user is allowed to search. My code works if I run it from command line app or using ASP.NET Development Server but it does not in the real scenario when running under IIS.
Nothing crashes, I'm just always getting zero archives (although archives I am allowed to access exist in my server).
My app is a simple ASP.NET C# app. I'm impersonating a user using LogonUser() and DuplicateToken() and Impersonate() calls. I thought this may be the problem so I tried the other way using <identity impersonate="true"/> in my web.config, but I got the same results.
Here is my code snippet:
-----------------
IContentManagementAPI2 CMAPI = (IContentManagementAPI2)new ContentManagementAPIClass();
IArchives archives1 = (IArchives)CMAPI.Archives;
archives1.Computer = sevServer;
archives1.Permissions = EV_STG_API_PERMISSIONS_TYPE.PERMISSIONS_SEARCH;
archives1.ArchiveTypes = (int)(EV_STG_API_ARCHIVE_TYPE.ARCHIVE_TYPE_MAILBOX |
EV_STG_API_ARCHIVE_TYPE.ARCHIVE_TYPE_SHARED |
EV_STG_API_ARCHIVE_TYPE.ARCHIVE_TYPE_FILE_SYSTEM |
EV_STG_API_ARCHIVE_TYPE.ARCHIVE_TYPE_PUBLIC_FOLDER);
archives1.Get();
int lCount = archives1.Count;
-------------------
and my lCount is always zero.
If I remove the line: archives1.Permissions = EV_STG_API_PERMISSIONS_TYPE.PERMISSIONS_SEARCH;
or set it to archives1.Permissions = EV_STG_API_PERMISSIONS_TYPE.PERMISSIONS_UNSPECIFIED;
then I get all the archives that exist on my server. So this leads me to the conclusion that SEV API is not, for some reason picking up the right credentials, however I have checked in the code and confirmed that my impersonation code works and that the user executing the enumeration code is the right one.
If anyone there has a clue what might be wrong, I'd really appreciate. This problem is giving me quite a bit of headache :)
Just one more thing regarding the impersonation. I also have an old Sev 6 server and the same impersonation code is working alright with an old SEV 6 Content Management API method EnumVaultsByMe
Thanks