How to make sub sites in SharePoint 2010 as Read Only

Hello,
We have a requirement to make sub site as read only in SharePoint 2010 programmatically.
How we can achieve it using Server Object Model ?
Thanks,
Hatim

Hi,
You can write a WinForm program, and use
SPSecurableObject.BreakRoleInheritance method to achieve your requirement.
More information for your reference:
http://fangdahai.blogspot.com/2012/09/how-to-set-sub-site-in-read-only-mode.html
https://social.msdn.microsoft.com/Forums/en-US/1f836da6-88ea-4d88-9e43-3383d139ca01/what-is-the-idea-of-stop-inheriting-permission-from-parent-site?forum=sharepointdevelopment
Best Regards
Dennis Guo
TechNet Community Support

Similar Messages

  • Howto make created folders/ files from one teacher, read only for other teachers?

    Hello there,
    as an admin @ school I was wondering how to make created folders/ files from one teacher, read only for other teachers?
     - In a 2008domain, created a group "teachers"
     - created a folder "teacher data" where all teachers have read/write permissions
    ideal,a teacher who make's a folder in "teacher data" should be the only oen who is able to add file's to that folder and dele that folder or files. Other teachers may be able to read the content of the folder.
    Is this possible to set up and how?
    many thanks.
    Nico.
    rds

    Hi Nico,
    You could set the permissions below to resolve the issue:
    For the root folder "teacher data": give the full control permission to CREATOR OWNER – "Subfolders and files only" and give the read/write permissions to the group "teachers"– "This folder only".
    Best Regards,
    Mandy 
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to check the user hits to the sites (most often,frequently used sites) in sharepoint 2010?

    HI,
    How to check the user hits to the sites (most often,frequently used sites) in sharepoint 2010?
    could you please help on the above?

    Hello Sudhir muvva,
    Just to be sure, the default Web Analytics reports don't meet your requirements?
    http://blogs.msdn.com/b/ecm/archive/2010/03/21/introducing-web-analytics-in-sharepoint-2010.aspx
    Does reports have subjects like top pages and number of page views.
    - Dennis | Netherlands | Blog |
    Twitter

  • How to exclude sub sites in navigation from C# code

                                                                
    Hi,
    I need show Global navigation items in custom web part, below code is returning global navigations with sub sites. 
    how to exclude sub sites and return only global navigation items links?
    using (SPSite spsite = new SPSite(SPContext.Current.Web.Url))
                        using (SPWeb web = spsite.OpenWeb())
                            SPNavigationNodeCollection colletion = web.Navigation.TopNavigationBar;
                            foreach (SPNavigationNode navigationNode in colletion)
    //Getting all global navigation nodes including sub sites
    please help me to resolve this.
    Thanks.

    This should work
    if(!web.isRootWeb){web.Navigation.GlobalNavigationNodes.Delete(navigationNode);web.Update()}
    Refer to the following post for more information
    http://www.learningsharepoint.com/2010/09/28/add-links-to-top-navigation-sharepoint-2010-programmatically/
    --Cheers

  • How to block specific DL in SharePoint 2010 application.

    Hi All,
    We have SharePoint 2010 farm. I have a requirement to block specific Distribution List which should not recognized when user trying to give access at (user.aspx page)site level.
    How can i  restrict this in SharePoint 2010 farm.
    Regards
    S. Mani

    You can use content editor webpart to run javascript. Java script will redirect users from accessing the site. You need t o specify the user Id; it wont work on DL
    Blow is the java script:
    ==================Script Start ===============
    ExecuteOrDelayUntilScriptLoaded(getWebUserData, "sp.js");
    var context = null;
    var web = null;
    var currentUser = null;
        function getWebUserData() {
            context = new SP.ClientContext.get_current();
            web = context.get_web();
            currentUser = web.get_currentUser();
           currentUser.retrieve();
            context.load(web);
            context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod));
        function onSuccessMethod(sender, args) {
            var userObject = web.get_currentUser();
            if (userObject.get_loginName() == 'i:0#.w|domain\userid')
               window.location="/businesses/pulpandfibre";
        function onFailureMethod(sender, args) {
            alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
    =============Script End===============

  • Create a mobile site in SharePoint 2010

    Hi,
    We have an Intranet publishing site in SharePoint 2010. 
    Currently we have shut off the mobile redirection, and let users interact with the full site on their mobile device.
    The new requirement is to extend this for mobiles without using the above approach. I found that using responsive grid we can modify the page layouts to be responsive. Hence thought of creating a seperate site collection with different pagelayouts.
    But this would mean recreating all the page layouts and content for new site collection. Also there would be some webparts which will have to display display data from different site collection.
    Can anyone please suggest a best approach for this issue.

    Follow these steps
    1) You can add a feature in your Project
    2) Open the feature and set scope to SITE, and give a feature title
    3) add your web part into this feature
    4) Now you can deploy the wsp in your destination site
    5) Once deployed, browse the site and go to site setting, site collection features, you will see your feature name here, you can active it
    6) Once activated, now you will be able to add your webpart on any web part or publishing page
    To ensure your webpart is installed, you can go to site settings -> web part gallary -> and see your webpart definition file should be available here
    Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
    INSQLSERVER.COM
    Mohammad Nizamuddin

  • Can't figure out how to make "sub-tabs" / Too many "top-tabs" / Other ?

    First of all, the website that I am webmaster for is: www.cindydennis.org .
    I am having some problems:
    1) There are TOO MANY tabs at the top. I can't figure out how to make sub-headings on one page...
    For example, I'd like on the "About CDM" page, tabs that can be clicked on to go to other information tabs, but that don't end up appearing on the top (e.g.: having "Remarks" and "What We Believe" tabs go there, but not appear at the top).
    Another example, if you look at the home screen, I'd like to have the link to the "Privacy Policy" and Terms of Service" pages on the bottom, but not have them appear as tabs in the top, too.
    How do I do this, please? I've searched, and can't figure out/___sbsstatic___/migration-images/migration-img-not-avail.png
    2) How do I add "Copyright 2011" automatically? I saw in the Rapidweaver trial version, it automatically adds it when you publish... is there a way to tell this program to do this? Or do I need to type that in on each page? (I don't want to purchase RW... I'm not ready for that yet.)
    Thank you in advance
    Cindee

    Cindee ~ One way to do the copyright notice is to use a Text Clipping — Select (highlight) the copyright text you want to use and drag it to the Desktop. If necessary, change the name of the Clipping icon so that it's more easily identifiable on the Desktop. Then, when you need it in iWeb, simply drag the Clipping icon from the Desktop to iWeb's main canvas.
    By the way, rather than posting your URL here like this:
    www.cindydennis.org
    ...include the prefix to make it conveniently clickable:
    http://www.cindydennis.org

  • How to make my site top in the search engines for a high ranking?

    I am new at this, and I am planning to build a big site on iweb, but my question is where can I get information on how to make my site with high rankings? Would I have to post my site in lots of search engines, or have the hosting company help out? how do i do this?

    As SEO (Search Engine Optimization) is important to you, you may want to consider alternatives to iWeb as "iWeb websites are not made to be search engine friendly" — read more here:
    SEO For iWeb: How to get your iWeb Websites into Google & Other Major Search Engines
    ...iWeb is designed for personal sites and, as such, Apple apparently thinks there's no need for Google — you tell grandma the URL of your personal iWeb site, she painstakingly types it in and then gazes admiringly at the photos of her grandchildren.
    Apple hasn't changed this approach in three iterations of iWeb but perhaps, with all the feedback it receives on this issue, there's still hope. Meanwhile, web-design apps for business sites tend to integrate search engine optimization — Sandvox Pro is an example:
    http://www.karelia.com/sandvox/getyour_site_noticed_andb.html
    Another advantage of Sandvox is that, when viewing your site in Safari, the text increase & decrease commands will work — they don't work for an iWeb-created site. ...For business use, it's important that customers don't turn away from your site because they consider your text too small to read.
    However, if you still really want to use iWeb, this article may help:
    http://www.iwebformusicians.com/SearchEngines/SEO.html
    By the way, for more info about SEO in general, this blog of a web-design app (Yola) recently started a multi-part series on the subject — the first is here:
    http://blog.yola.com/2009/06/15/seo-101
    The rest of the series (in no particular order) can be found here:
    http://blog.yola.com/category/seo/
    And a video:
    _Using Title Tags Effectively For Search Engine Optimization (SEO)_

  • How to create sharepoint Group with read only permissions using powershell for entire site ?

    How to create sharepoint Group with read only permissions using powershell for entire site (including subsites and top level site)

    Hi
    using (SPSite site = new SPSite(url))
    using (SPWeb web = site.OpenWeb())
    SPUserCollection users = Web.AllUsers;
    SPUser owner = users[string.Format("{0}{1}", "Domain", "Owner Username")];
    SPMember member = users[string.Format("{0}{1}", "Domain", "Default Member Username")];
    SPGroupCollection groups = Web.SiteGroups;
    string GroupName = “Super Exclusive”;//your group name
    string GroupDescription = “Super exclusive group description.”;
    groups.Add(GroupName, owner, member, GroupDescription);
    SPGroup NewSPGroup = groups[GroupName];
    SPRoleDefinition role = Web.RoleDefinitions["Read"];
    SPRoleAssignment roleAssignment = new SPRoleAssignment(NewSPGroup);
    roleAssignment.RoleDefinitionBindings.Add(role);
    Web.RoleAssignments.Add(roleAssignment);
    Web.Update();
    Please 'propose
    as answer' if it helped you, also 'vote
    helpful' if you like this reply.

  • List all users with full control on a SharePoint 2013 Sub site from SharePoint Object Model in C#

    If I have a sub site URL and a user with Site Admin, can I list all users in that sub site that have Full Control at that level?
    Any C# code sample?

    Still you can do that, just pass the subsites to your code and from their you can find the users dynamically.
    You could also use SPWeb.Users property to get users assigned to a subsite
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.users(v=office.15).aspx
    alternatively you can also use SPWeb.SiteUsers to get all users
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.siteusers(v=office.15).aspx
    other APIs of help-
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.associatedmembergroup(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.associatedownergroup(v=office.15).aspx
    http://sharepoint.stackexchange.com/questions/101671/object-model-list-all-users-with-full-control-on-a-sub-site-in-sharepoint-2013
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • Copy files using modules to sub site in sharepoint

    Hi Team
    copy files using modules to sub site in sharepoint 

    Hi,
    Here is an example of the Elements.xml file for a module:
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Module1">
    <File Path="Module1\Sample.txt" Url="Module1/Sample.txt" />
    </Module>
    </Elements>
    More information:
    Sharepoint 2013 deploying files using a module to subsites
    http://sharepoint.stackexchange.com/questions/79290/sharepoint-2013-deploying-files-using-a-module-to-subsites
    Copy file from feature to subsite?
    https://social.msdn.microsoft.com/Forums/en-US/83ff07ca-0896-4e98-bd47-b4ffeb9f6ebd/copy-file-from-feature-to-subsite
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Hello, i would like to know how to make horizontal sites and it moves with the scroll

    Hello, i would like to know how to make horizontal sites and it moves with the scroll

    Hi
    You can refer to these videos :
    http://www.lynda.com/Muse-tutorials/basics-horizontal-scrolling-websites/108131/115685-4.h tml
    https://www.youtube.com/watch?v=gZI_K1TXqOM
    Thanks,
    Sanjit

  • How to grant anonymous access on sharepoint document library/list only not for web application

    Hello
    How to grant anonymous access on sharepoint document library/list only not for web application.I have claim based sharepoint site and has to be but i want to grant access on document library/list only.Is this possible?
    Thanks
    Rajesh Kumar "Changing the Face" can change nothing.But "Facing the Change" can change everything.

    As i am using following code
    SPSite site = SPContext.Current.Site;
                SPWeb web = SPContext.Current.Web;
                SPSecurity.RunWithElevatedPrivileges(delegate()
                    using (SPSite ospSite = new SPSite(site.ID))
                        using (SPWeb webs = ospSite.OpenWeb(web.ID))
                            // Enable anonymous access on web application
                            webs.AllowUnsafeUpdates = true;
                            SPUrlZone urlZone = SPUrlZone.Default;
                            SPWebApplication specifiedWebApplication = ospSite.WebApplication;
                            SPIisSettings iisSettings = specifiedWebApplication.IisSettings[urlZone];
                            //iisSettings.AuthenticationMode = AuthenticationMode.Windows;
                            iisSettings.AllowAnonymous = true;                       
                            specifiedWebApplication.Update();
                            // Get document library collection here and fetch all the document urls
                            SPDocumentLibrary docLib = (SPDocumentLibrary)web.Lists["Documents"];
                            if (docLib != null)
                                docLib.BreakRoleInheritance(true, false);
                                docLib.AllowEveryoneViewItems = true;
                                docLib.AnonymousPermMask64 = SPBasePermissions.ViewPages | SPBasePermissions.OpenItems | SPBasePermissions.ViewVersions
                                    | SPBasePermissions.Open | SPBasePermissions.UseClientIntegration | SPBasePermissions.ViewFormPages | SPBasePermissions.ViewListItems;
                                //docLib.AnonymousPermMask64 = SPBasePermissions.EmptyMask;
                                docLib.Update();
    Should working but getting access denied......i am totally stuck at this point.
    Rajesh Kumar "Changing the Face" can change nothing.But "Facing the Change" can change everything.

  • How to make an hypertext link workable with adobe reader for IOS ?

    Hello,
    Hypertext links in a PDF file work perfectly well on Mac OS (Yosemite).
    The same document on an IPAD with IOS is not able to open an hypertext link ...
    How could I do to solve this problem ?
    An author who want to publish electronic books with hypertext links on mobile devices

    Hello Steve,
    All my best wishes for the new year.
    To answer your question :
    . I am writing books on my IMAC with Yosemite  (10.10.1) using Word (14.4.7)
    of  OFFICE MAC.
    . I can open Hyperlink connection by clicking on the link
            . I save the document in a .PDF format
    . This document is sent to my IPAD with IOS 8.1.2
    . In this .PDF document I am no more able to open hyperlink connection
    Please see attached an abstract of my book.
    Thanks a lot for your help and advices.
    Michel Poncet
    Tel: +33 4 76 89 50 82
    http://www.amazon.fr/Glariand-Copent/e/B007NXP7FU
    De :  Steve Werner <[email protected]>
    Répondre à : 
    <[email protected]>
    Date :  vendredi 2 janvier 2015 03:34
    À :  Michel Poncet <[email protected]>
    Objet :   How to make an hypertext link workable with
    adobe reader for IOS ?
    How to make an hypertext link workable with adobe reader for IOS ?
    created by Steve Werner <https://forums.adobe.com/people/Steve+Werner>  in
    Adobe Reader for iOS - View the full discussion
    <https://forums.adobe.com/message/7058559#7058559>
    Hyperlinks can be of several types. What are you linking to? Exactly what
    application did you test the hyperlinks with on the Mac? What application
    did you use to create the hyperlinks?
    If the reply above answers your question, please take a moment to mark this
    answer as correct by visiting:
    https://forums.adobe.com/message/7058559#7058559 and clicking ŒCorrect¹
    below the answer Replies to this message go to everyone subscribed to this
    thread, not directly to the person who posted the message. To post a reply,
    either reply to this email or visit the message page:
    Please note that the Adobe
    Forums do not accept email attachments. If you want to embed an image in
    your message please visit the thread in the forum and click the camera icon:
    https://forums.adobe.com/message/7058559#7058559 To unsubscribe from this
    thread, please visit the message page at
    , click "Following" at the
    top right, & "Stop Following" Start a new discussion in Adobe Reader for iOS
    by email
    <mailto:[email protected]eso
    ftware.com>  or at Adobe Community
    <https://forums.adobe.com/choose-container.jspa?contentType=1&containerType=
    14&container=4631>  For more information about maintaining your forum email
    notifications please go to https://forums.adobe.com/thread/1516624.

  • How to make pdf file auto open with adobe reader after downloaded

    how to make pdf file auto open with adobe reader after downloaded

    I note from your system details that you have the plugin for adobe pdf s so I would have expected the files should open in firefox '''without''' you needing to explicitly download them.
    Once the files are open in firefox, you will also get the option to save them permanently to a location on your computer. If you wish I suppose you could set the file type pdf to be associated with and be opened by firefox instead of with the Adobe Acrobat Reader, but that would just seem to be an additional complexity.

Maybe you are looking for