Hi all,
For one of our customers I have a customization in which I have to determine if the page with a certain URL is published or not. To do this I run the following code with elevated priveledges:
using (SPSite site = new SPSite(url)) { using (SPWeb web = site.OpenWeb()) { PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web); if (publishingWeb != null) { try { SPListItem item = web.GetListItem(url); isPagePublished = item.HasPublishedVersion; } catch (Exception ex) { LogMessage("IsPagePublished: fout: " + ex.Message); } } } }
When I run this code on my development environment and on my test environment it works as expected and no errors occur. But when the customer installs it in their test environment an exception is caught, the exception message is: <nativehr>0x80070057</nativehr><nativestack></nativestack>
I have no clue why the exception occurs and how I can prevent it. Any hint would be welcome!
Thanks in advance!
Henk