private SPWeb OpenWeb(Guid webId) { SPWeb web = SPExtensionHelper.OpenWebSafe(contextSite, webId); disposables.Add(web); return(web); }
/// <summary> /// Gets an <see cref="Microsoft.SharePoint.SPWeb"/> object with the given URL. /// </summary> /// <param name="webUrl">Site URL.</param> /// <returns>An <see cref="Microsoft.SharePoint.SPWeb"/> object in cache. NULL if site of given URL does not exist.</returns> public SPWeb TryGetWeb(string webUrl) { CommonHelper.ConfirmNotNull(webUrl, "webUrl"); SPListLookupKey lookupKey = hashtable[webUrl] as SPListLookupKey; if (lookupKey != null) { return(GetWeb(lookupKey.WebId)); } SPWeb web = SPExtensionHelper.OpenWebSafe(contextSite, webUrl, false); if (web != null) { SPWeb returnValue = AddWeb(web); if (returnValue != web) { web.Dispose(); } return(returnValue); } return(null); }