spweb

SharePoint, how do you programatically determine the storage size of a SPWeb?

Not of the site collection itself, but the individual SPWeb's. ...

Best Pattern for AllowUnsafeUpdates

So far, in my research I have seen that it is unwise to set AllowUnsafeUpdates on GET request operation to avoid cross site scripting. But, if it is required to allow this, what is the proper way to handle the situation to mitigate any exposure? Here is my best first guess on a reliable pattern if you absolutely need to allow web or si...

How do I programatically turn off show pages in navigation for sharepoint

I am progamatically creating a SharePoint site using SPWeb spWeb = spSite.AllWebs.Add(...); What code do I need run to set the spWeb to turn off the "Show pages in navigation" option? Answer: publishingWeb.IncludePagesInNavigation = false; ...

SPCrossListQuery fails to bring back results

I am calling SPWeb.GetSiteData(anSpCrossListQuery). It fails to bring back any results or any errors when I call it with an accidental space at the end of the CAML query <Where></Where> clause. Anyone have an idea why? ...

Programmatically Accessing SharePoint Style Library from within C#

Hi all Firstly, I'm a newbie to C# and SharePoint, (less than a month's experience) so apologies if this is an obvious or easy question but I've been trawling the net for a couple of days now with absolutely no success. I have an xslt file that I have stored in a subdirectory of 'Style Library' from within the new website but how can I...

How can i know if a given SPWeb is a SearchCenter site programmatically

I have a SPWeb object and I want to know whether or not this is a SearchCenter site. How can I know it programmatically. Is there some setting to check or a guid to match etc? ...

How do I open search center web for a given site

I can determine the search center page for a site using: site.OpenWeb().AllProperties["SRCH_ENH_FTR_URL"] If I have multiple sites in a web application say site1 and site2. site1 has searchcenter page. site2 does not have one. But for site 2 if i put /SearchCenter/Pages for the search center. It uses the site1's search center. Howev...

Capturing title change event on SPWeb

I am listening on a particular SPWeb using an SPWebEventReceiver that is successfully firing on the WebMoved event. When the web is moved I update a list with the new location/title. What I would like to be able to do is listen for when the Web is renamed . Do I do this by attaching an item listener and waiting for an ItemUpdated even...

why my sharepoint workflow always stop when i use this code ?

I need to find an user in a list to set the assignedto task property, these informations are in a list. So i use this method : public static SPUser GetSPUser(SPListItem item, string key){ SPFieldUser field = item.Fields[key] as SPFieldUser; if (field != null) { SPFieldUserValue fieldValue = field.GetFieldValue(ite...

How to enumerate all webs and data in a SharePoint site collection

What is the best way to enumerate all SPWebs in an SPSite and also to enumerate folders within document libraries within each of the SPWebs? (essentially I want to find out the urls of all SPWebs, and the number of folders and amount of data being stored in each). I have achieved the above in C# using the SharePoint API but that takes a...

SPWeb.Url returns wrong URL

I have a web application in SharePoint that has been extended to another zone (Extranet). The access URL for the default zone is http ://server1, and the URL for the extranet zone is https: //www.server1.com. Now, when I access the site via the extranet zone, I find that SPContext.Current.Web.Url returns http ://server1. I would have ex...

Is possible to inherit from SPWeb?

Hi, Is possible to inherit from SharePoint classes such like: SPWeb, SPList etc. or this classes are sealed? I couldn't find right answer. Chris ...