As soon as I have more news/fix/info about it I will update this post. Thanks to all the Aptimize people for the contact and great support on this case.
If you are using a product called Aptimize for SharePoint you might have noticed that it is a great product when it comes to minimizing the footprint in the front end and reducing the rendered size of the output. Unfortunately with great power comes also some inconvenient bugs. Like the one below.
In our test scenario we will have a normal SharePoint document library...
...with versioning, content approval and major and minor versions enabled.
Then we will have a custom SharePoint page with a custom webpart in it that does a simple thing: loop through the specified library and builds up a list of those items who are published or have a published version.
1 private static void LoadFake(SPSite site, string virtualLibraryPath, IDictionary<string, bool> fake)
3 using (SPWeb web = site.OpenWeb(virtualLibraryPath))
5 SPList list = web.GetList(virtualLibraryPath);
6 SPListItemCollection items = list.Items;
7 foreach (SPListItem item in items)
11 // do anything here...
error: access denied - current user - you are currently signed in as: xxx - sign in as a different userIf you go to the event viewer you will notice that Aptimize might be running with no problems at all.
Aptimize Website Accelerator initialized successfully.
But then a lit bit later you will see these two entries in the event log
Error initializing Safe control - Assembly:Mondosoft.Ontolica.SharePoint.Reporting, Version=22.214.171.124, Culture=neutral, PublicKeyToken=c7127db7656685c6 TypeName: Mondosoft.Ontolica.SharePoint.Reporting.WebControls.WebParts.ReportingWebPart Error: Could not load file or assembly 'Microsoft.ReportingServices.SharePoint.UI.WebParts, Version=126.96.36.199, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp
The description for Event ID ( 8214 ) in Source ( Windows SharePoint Services 3 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: A request was made for a URL, http://xx.xx.xx.xx, which has not been configured in Alternate Access Mappings. Some links may point to the Alternate Access URL for the default zone, http://www.www.ww. Review the Alternate Access mappings for this Web application at http://myserver:9100/_admin/AlternateUrlCollections.aspx and consider adding http://xxx.xxx.xxx.xx as a Public Alternate Access URL if it will be used frequently. Help on this error: http://go.microsoft.com/fwlink/?LinkId=114854
If you now go to the Aptimize console and turn off the website optimization, the error goes away.
The curious thing. if you debug that code above you will noticed that an exception will happen at line #9.
Apparently Aptimize is doing something under the hood that causes a privilege exception when calling SPListItem.HasPublishedVersion even if you are running as System Administrator and even if you are running using RunWithElevatedPrivileges method. Inspect the returned error and it will see an UnauthorizedAccessException.
The fix for now is to avoid calling HasPublishedVersion until we hear back from the Aptimize guys.
If someone out there seen the same issue and would like to share any ideas, feel free. Meanwhile I hope this workaround helps someone.
See you later
By Edge Pereira