Then you don't want to query the SPSite object- you want to query the SPWeb object for "http://urlhost/edu/projects"
For example:
SPSite siteCollection = new SPSite("https://urlhost/edu/projects");
SPWeb projectsWeb = siteCollection.OpenWeb();
SPWebCollection webs = projectsWeb.GetSubwebsForCurrentUser();
Note - do not forget that you should be disposing of the SPSite and SPWeb
objects!
Ishai Sagi
Solutions Architect
Information Services
Mobile: 04 2379 1728
Email: [email protected]<mailto:[email protected]>
Web: www.uniqueworld.net<http://www.uniqueworld.net>
Blog: www.sharepoint-tips.com<http://www.sharepoint-tips.com/>
[cid:[email protected]]<http://www.uniqueworld.net/>
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Grist
Sent: Thursday, 12 February 2009 8:47 AM
To: [email protected]
Subject: RE: webpart issue
Thanks for that.
Using that command, it seems to go right up to the root of the site collection
i.e.: http://urlhost/
And get the sub webs there, is there any way to get the sub webs just for
http://urlhost/edu/projects
From: [email protected] [mailto:[email protected]] On Behalf Of Gerald De Run
Sent: Thursday, 12 February 2009 8:00 AM
To: [email protected]
Subject: RE: webpart issue
Chris,
The second line of code is causing the permission denied error. The AllWebs
property is not available for normal users.
You can try using siteCollection.RootWeb.GetSubwebsForCurrentUser() to return
the SPWeb objects available to the current user.
Regards,
Gerald de Run
From: [email protected] [mailto:[email protected]] On Behalf Of Chris Grist
Sent: Thursday, 12 February 2009 8:26 AM
To: [email protected]
Subject: webpart issue
Hi Guys,
Ive written a simple web part to rollup from several sites some information
from some identical lists.
It works perfect for me (Site Collection Admin), however for normal users it
does not, I have checked and even with full control over all the sites the
outcome is the same, basically they get a permission denied page when the web
part is loaded.
The main two lines of code that I would imagine are effecting it are:
SPSite siteCollection = new
SPSite("https://urlhost/edu/projects");
SPWebCollection webs = siteCollection.AllWebs;
Would this be causing them to get a permission denied error?
Chris Grist
Technical Officer, ICT Systems
Education.au Limited
Level 1, 182 Fullarton Road
DULWICH SA 5065
p +61 8 83343291
f +61 8 83343211
e [email protected]<mailto:[email protected]>
w www.educationau.edu.au<http://www.educationau.edu.au/>
________________________________
IMPORTANT: This e-mail, including any attachments, may contain private or
confidential information. If you think you may not be the intended recipient,
or if you have received this e-mail in error, please contact the sender
immediately and delete all copies of this e-mail. If you are not the intended
recipient, you must not reproduce any part of this e-mail or disclose its
contents to any other party. This email represents the views of the individual
sender, which do not necessarily reflect those of Education.au except where the
sender expressly states otherwise. It is your responsibility to scan this email
and any files transmitted with it for viruses or any other defects.
education.au limited will not be liable for any loss, damage or consequence
caused directly or indirectly by this email.
________________________________
Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists
________________________________
Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists
________________________________
IMPORTANT: This e-mail, including any attachments, may contain private or
confidential information. If you think you may not be the intended recipient,
or if you have received this e-mail in error, please contact the sender
immediately and delete all copies of this e-mail. If you are not the intended
recipient, you must not reproduce any part of this e-mail or disclose its
contents to any other party. This email represents the views of the individual
sender, which do not necessarily reflect those of Education.au except where the
sender expressly states otherwise. It is your responsibility to scan this email
and any files transmitted with it for viruses or any other defects.
education.au limited will not be liable for any loss, damage or consequence
caused directly or indirectly by this email.
________________________________
Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists
--------------------------------------------------------------------------------
Support procedure: http://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists
<<inline: image001.gif>>
