1
vote
2answers
85 views

AssociatedGroups collection of SPWeb?

I'm having a hard time understanding the purpose of adding an SPGroup to the AssociatedGroups collection (or its respective property bag item) of a site other than the group(s) appearing in the quick ...
0
votes
0answers
406 views

SPWeb.GetFolder() returns SPFolder with no files or sub folders

I'm encountering a strange problem on SharePoint 2007 where the following script correctly enumerates files and folders on my QA and DEV sites, but not on my Production site. Why is SPWeb.GetFolder() ...
4
votes
3answers
102 views

best way to store property of a site

I have a site called Exhibitions that contains many many subsites each of which is an individual exhibition (with pages, images etc). I would like to attach to each of these subsites a property which ...
1
vote
3answers
82 views

Is using the Using statement to close unknown and possibly Current webs, bad practice?

Until today I had been using the Using statement to open and dispose of webs. The variable relative_web_url is defined by a user input in the custom web part editor. using (SPWeb web = ...
0
votes
2answers
57 views

How do I figure out if I have permissions to use site.openWebs without changing code?

I have been newly assigned to a client and I am trying to run an existing console app to get some information about files within their sharepoint instance. The code goes something like this: //Enter ...
1
vote
1answer
1k views

c# iterating SPWeb.Navigation.GlobalNodes

When I try to iterate through the GlobalNodes collection using c# it is always empty unless I the site and manipulate the navigation settings manually. Can anyone tell me why this is and/or give an ...
2
votes
4answers
518 views

What are the dangers of disposing of SPWeb when it's automatically disposed of?

In some cases such as: using (SPSite site = new SPSite(@"http://sitecollection/")) { SPWeb web = site.RootWeb; } you don't need to dispose of the SPWeb object because it is disposed of ...
3
votes
3answers
1k views

How to create Site (SPWeb) on Sharepoint Online

I have a problem creating Sites on Sharepoint Online. The code that works on-premise do not work on Sharepoint Online. I do not want to bother you with the code, i just want a clean start. So my ...
1
vote
2answers
1k views

Error using SPRequest when the SPWeb is already disposed

Is this correct way of using the SPSite and SPWeb and the SPList. private SPList list; pulic void getList() { using (SPSite site = SPContext.Current.Web.Site.WebApplication.Sites[0]) { using ...
3
votes
1answer
174 views

Disposing of SPWeb object query

I'm trying to understanding the object clean up process. using (SPSite siteCollection = new SPSite(siteUrl)) { SPWeb site = siteCollection.RootWeb; foreach (SPList list in site.Lists) { if ...
0
votes
1answer
180 views

Sharepoint 2007 WarmUp Script (Memory Leak Possibly)

I was wondering if there is any way I can get a SPsiteCollection object using a URL + if I can dispose it using "using" keyword as well. I want to go through all the SPWebAPplications in a Local ...
7
votes
4answers
804 views

What are the dangers of using a static class that contains your SPWeb object?

When creating my SharePoint 2010 solutions, I often create a static class that contains helper methods and lists, documents, list items, etc that I use frequently. What would the dangers of putting my ...
0
votes
2answers
227 views

SPWeb object is empty

I create a SPWeb object with a relative url to my SPSite using (SPWeb web = SPContext.Current.Site.OpenWeb(url)) { SPList centralManagementList = web.Site.RootWeb.Lists["mylist"]; string id = ...
5
votes
2answers
1k views

Do I need to reset SPWeb.AllowUnsafeUpdates after use?

Do I need to reset the SPWeb.AllowUnsafeUpdates property after use? Seems not, but all over the web there is code like: bool allowUnsafeOrig = web.AllowUnsafeUpdates; web.AllowUnsafeUpdates = true; ...
3
votes
4answers
2k views

Get SPWeb by ID without Site Collection?

I have a list of SPWeb IDs and would like to open the associated SPWeb objects. However, I do not know in which Site Collection they are (I DO know that they are in the current Web Application ...
7
votes
3answers
538 views

Should SPWeb objects be passed to other methods or re-instantiated?

Should I pass my SPWeb object to a method or recreate it in that method?
0
votes
2answers
152 views

SP2010 Update Site Title and Description - Security problem

I've created a custom application page to update the Title and Description of a site. The page is generating an access denied and the following error message in the log file: Unknown SPRequest ...
3
votes
4answers
1k views

How to properly use the Using Statement with SharePoint Objects

What is best practice with the Using statement when working with SharePoint Objects. When and how should you use the Using statement, so objects used are disposed, etc?
18
votes
3answers
4k views

Find Document by GUID

I'm missing something that must be so simple that it's not even worth asking... but I have an object ID (GUID)... How do I figure out the document it points to? For example I have a GUID of ...
1
vote
3answers
1k views

Storing custom properties for a SharePoint Site

Let's say you are building a Project Management solution where each Project equals one site (SPWeb object). Each project has it's properties like: Project Manager, Budget, Customer, Description, ...
4
votes
5answers
3k views

Disposal of SPWebs created using SPSite.OpenWeb()

After reading some answers/comments on Disposal of SPWebs retrieved from SPContext.Current.Site.AllWebs, I opened up Reflector to dig deeper into the SPSite and SPWeb classes. I ran into a surprise, ...
6
votes
3answers
3k views

Disposal of SPWebs retrieved from SPContext.Current.Site.AllWebs

As there was a minor disagreement on whether SPWebs retrieved from SPContext.Current.Site.AllWebs should be disposed, I thought it would be appropriate to post a new question and discuss it here. I ...
2
votes
1answer
1k views

What is the SPWeb.Name property for?

I'm wondering what use does the SPWeb.Name property have. Is it displayed anywhere?