.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Breaking inheritance and assigning unique permissions once a site is created programicaly

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :SharePoint

I am creating a site prosaically with an event receiver.  The actual creation code is here.

SPWeb site = parentWeb.Webs.Add(siteName, siteTitle, description, EnglishLocaleId, siteTemplate, false, false);

I can create the site and use my custom template.  Problem is I want to us unique groups and permissions.  I cannot find anywhere if this can be done with Webs.Add.

Can this be done, or is there another way I should be creating these sites and assigning the unique permissions?

Thank you very much.


View Complete Post

More Related Resource Links

Master Pages: Master Your Site Design with Visual Inheritance and Page Templates


Master pages in ASP.NET 2.0 solve a problem many Web developers have been solving on their own with a variety of techniques for years - providing a single master template for an entire site. This article covers the details of master pages, discussing their usage and implementation and how they are a natural evolution of custom techniques developers are using today.

Fritz Onion

MSDN Magazine June 2004

Breaking news crawing horizontally web part in MOSS site



I would like to know which approach would be the best to show breaking news which will craws horizontally in MOSS site

Breaking a URL to site and file url

HI,    I have the url of  a file. Now I want to run the GetVersion webservice to get the versions of the file but this webservice takes the file url. So I need to break the full url into two parts SiteUrl + fileUrl. How can I do that using webservice. I know a method using FPRPC method "url to web url" call but that method is not working if the file url contains character of languages other than English.If someone has any idea about this issue as well than it would be a great help. Thanks and Regards

Navigation settings not applied when site created from template?

Hi, I created a customized site on MOSS and disabled Quick Launch and enabled Tree View on it. But when I create new site from this template it has Quick Launch enabled and Tree View disabled. I downloaded the STP file and looked inside and in the details <Details> ... <EnableTreeView>1</EnableTreeView> <EnableQuickLaunch>0</EnableQuickLaunch> ... </Details> Does anyone have a clue why it does not work correctly? Does this work for you correctly?  

File not found error when trying to open site permissions on a blog site

We have created a simple team site and a block subsite.  When trying to edit the site permissions we see the following error.  Any ideas? When opening a blog site and clicking Site Actions - site permissions we received a new page with the following error: Error File Not Found Troubleshoot issue with Microsoft Sharepoint Foundation Correlation ID: 51b54786-f344-4474-b88e-3080c363693 Date and Time: 3/24/2010 3:03:38 PM

Need a WebPart to show permissions on site

HiI need a web part that will display the permissions for a site (web part is added to the site) so that users can see what level of permissions have been set before they add any content.This will be Doc Libraries, Lists, Blogs etc.Does anyone know of such a thing?ThanksRob

New Document Library in a subsite is inheriting permissions from wrong site

I have a site collection (using the out-of-the-box Business Intelligence site template) called "BI Home". A couple weeks ago I created a bunch of subsites (Finance, Regulatory, Marketing, etc.) all using the BI site template, and then created a Document Library called "Reports" in each one of those subsites. Those are all working as expected. Yesterday I needed to create a new subsite (again, a BI site just off the root site collection) called "Operations". I created the subsite, and then created the "Reports" document library underneath it.  When I went to modify the permissions of the new document library (located here: /Operations/Reports), it said it was inheriting permissions from it's parent: "BI Home".  Why would this be?  Shouldn't the parent be "Operations" ?? All my other sites' "Reports" folders are inheriting permission from their respective parent, but any new sites I create seem to have this issue. Thanks in advance for any insight someone may provide! [SharePoint 2010 RTM on Win2k8R2 using SQL 2008R2 RTM on Win2k8R2]

How to post comments in blogs created on My Site sites

Hi all, I've been trying to comment in blogs created on My Site sites of other users in my SharePoint 2010 organization. But the only one allowed to comment a blog is the owner of the site. Does anyone knows how can I enable this option to other users? Thanks in advance for you help.

Unique quotes site Sharepoint 2010

Hello. Sharepoint Server 2010 Standart. There are sites collection, with a quota template to 5Gb. Some sites require different quotes than the rest of the family. Question: how these sites change the quota template to a non-quota template the entire sites collection. Structure: sitecollection (quoteSC) | site1 (inherits quoteSC) | site 1.1 (inherits quoteSC) | site 1.1.1 I want custom quote for this site!

Programmatically(WSS Web Services) Inheriting Parent Site Permissions for Workspaces

I'm able to create meeting work spaces in Sharepoint 2007 using the WSS web services. This issue that I'm running into is that the default is not inheriting permissions from the parent site. I'm looking for a way to configure this option for the work space programmatically through the use of the WSS web services. I've tried changing this in the template that I'm using to create the workspace, but this does not seem to effect the end results.Regards,Timothy H

Set execute permissions for web site at web host

Hi all,    I have just succeeded doing a Publish to server from my local sql db and run the sql script on my web host's sql server 2005 db. (I'm very proud! :-)   )   Now, I get the dreaded The EXECUTE permission was denied on the object 'MyStoredproc', database 'db12345', schema 'dbo'. error. I can't set the permissions from within Visual Studio, can I? What should I ask the web host to do? a) Should I ask them to globally set execute permission on ...? b) Should I ask them to set execute permissions to ... for only INSERT/DELETE/UPDATE stored procedures? c) Should I ask them nothing, and handle this myself? If so, then how? And, the question remains, should I set execute permissions globally or on a per stored proc basis? And what's the name of the user who needs the property set correctly? The reason why I ask these questionsis that I used to work with winfomrs at a university. There people should have different permissions depending on what group of users they belonged to. In this instace I have no idea!   Muchos gracias in advance, Pettrer, Sweden

Report on Sites, Lists and Libraries with Unique Permissions

I would like to get a report on Sites, Pages, Lists, Libraries, Items and Documents under a Site Collection having Unique Permissions. What is the best way to accomplish that ?

Master page is reset to v4.master when new site is created.

Hi, I have a site definition which specifies my custom master pages like this: <Project... <Configurations> <Configuration ID="0" Name="Innovations" CustomMasterUrl="_catalogs/masterpage/Innovations.master" MasterUrl="_catalogs/masterpage/Innovations.master"> ... I have a site collection http://myserver/projects and a sub-site TestSite at http://myserver/projects/testsite based on that definition above. I save TestSite as a site template and then create a new site Test2 at http://myserver/projects/test2 from the saved template. All seems to be ok but new site master page is v4.master and not Innovations.master. What's wrong here? Of course I can manually change it to Innovation.master but isn't it supposed to be done automatically upon site creation?

Upgrade Solution using a .wsp file created from a site template

Hello, I'm creating a new site template that I will need to move from my development to production server. I have saved the template as a .wsp file and installed it on my staging server without any problems. However, I know once the site goes into production that changes will occur and I will need to upgrade the site template. I have tried to make changes to my development site and save a new site template, and then move to my staging server and upgrade the existing solution using the below PowerShell command, but I get an error that the GUIDS are different and the solution cannot be upgraded. Command: Update-SPUserSolution -Identity MyTemplate v1.wsp -Site http://webapplication/site  -ToSolution MyTemplate v2.wsp Error: Update-SPUserSolution : Given solution cannot be upgraded to the provided ToSolution because the solutions have different Guids. Does anyone know how I would upgrade the solution when using a site template as the bases for the solution? Thanks, wm5

Sharepoint 2010: Get error: You do not have permissions to have lists and pages within My Site.

I am using the administrator login for the sharepoint 2010 farm.  I'm able to access My Site.  However, when I click on My content, I'm getting You do not have permissions to have lists and pages within My Site.   Any ideas?   Thanks.

Setting sql permissions for web site visitors

Hi all, I have my SqlServer 2005 database at a web host. I recently figured out how to set permissions for the stored procedures (see this link if you face the same problem: http://forums.asp.net/t/1600637.aspx) . Now I wonder: What permissions should I give the web site's visitors? In a stored procedure's Properties window, I have three availabale users, the db owner (the db name), "guest" and "public". My bet is on public.  As far as permission types go, I hev the following available: Alter, Control, Execute, Take Ownership, and View Definition. My guess is that the one of interest is Execute, correct?   In other words, should I set all stored procedures to Execute for public (not that I seem to have the permission to do that myself - I get an error message when I try to alter them)? If so, could I ask the web host to set them globally for me? Or should I only set stored procedure using UPDATE/INSERT/DELETE to Execute?   Thanks a lot for any replies, Pettrer  

MySite user profile site creation of My Content page is created as provisioned failed (unprovisioned

I've been trying to troubleshoot our User Profile Sync and have noticed the profile pages weren't getting updated with everything.  Most content was but things like memberships and the content tabs weren't.  I also saw this error in ULS: ProfSynch: Exception attempting to enumerate site 25a72070-4249-4698-ae99-c2a45d25b08e for ContentDB 23a6e3ef-6d56-4bde-825e-95c6924e2f91: Microsoft.Office.Server.UserProfiles.ProfileSynchronizationInternalException: ProfSynch: The site with ID 25a72070-4249-4698-ae99-c2a45d25b08e cannot be synchronized due to an unprovisioned root web.      at Microsoft.Office.Server.UserProfiles.SiteSynchronizerCollection.GetSynchInfoForSite(SqlDataReader dr, SynchInfo info)      at Microsoft.Office.Server.UserProfiles.SiteSynchronizerCollection.<get_Elements>d__0.MoveNext() I checked in the MySite database under the webs table and noticed all the My Content sites for all of our users had the flag column with the number 1315 in them - (meaning unprovisioned as the error above states).  Cross checking with the User Sync Profile database under the SiteSynch table I noticed all of the sites have NULL for the value under both the LastSynch and ChangeToken columns (The User Profile Service Application - User Profile to SharePoint Full Synchronization  timer job takes care of populating that).&
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend