.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

Feature with wsp for creating specific groups on any site creation

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :SharePoint
hi, i need to create a sharepoint feature for wss 3.0 with .wsp (wsp for easy deployment) which do folowing funtionality: Ability to run some custom code for creating specific custom groups on every site creation. Feature needs to be activated when deployed so when user create new site it creates groups based on our custom code( i have custom code for creating gorups just need to know how to attached it to feature which works on every site creation event) Any workable example is very helpful for me because i am very confuse and already did reasearch on that. i guess feature stapling is not the solution in my case. Thanks in advanced shaheen

View Complete Post

More Related Resource Links

how to disable creation of security groups as part of site provisioning for out of the box

I have requirements that I would like to create the sites with no security groups. Add users with specific permissions levels. Is there a way to disable the step in the default site provisioning process for out of box templates, that not to ask for creating of the security groups..net Architect

Running code after site definition site creation in a event receiver or feature receiver

Hi guys I've got a site definition which is pretty much based on STS.This is it's own sharepoint project. Let's call this project SiteDefProj. Next in another SharePoint project (same solution though). Let's call this CustomListProject. In this project I've got a feature which provisions a bunch of lists based on custom content types - this feature is a site scoped. Let's call this feature: CustomListInstances. I have added a feature receiver to this feature to execute some custom code on the lists themselves (under feature activated) In my ONET.XML (part of the SiteDefProj) I have CustomListInstances feature ID as part of my <sitefeatures>. When I do a create site I can actually step through the code and see it actually being executed but after the site is created the list instances are created but it's like the code never run or did anything. The weird part is that stepping through the code while creating a site collection using my SiteDefProj the code runs great with no errors. All lists are there and the code runs smooth. If I manually create a STS site and activate my feature everything works and the code does actually run and the effects are visible after the feature is created. Again I can actually step through it in debug. My suspicion is that there's some sort of a race condition in the CREATE SITE functionality where maybe the web or site collection hol

MySite creation fail - There has been an error creating the personal site. Contact your site adminis



I have a MOSS 2007 installation patched up to Cumulative Patch December, but are experiencing some issues with MySite.

When users access MySite, they recieve this errormessage in their browser: There has been an error creating the personal site. Contact your site administrator for more information.

This is followed up with this logged event on the server:


My Site creation failure for user 'DOMAIN\username' for site url 'https://mysite.domain.com/personal/domain_user'. The exception was: Microsoft.Office.Server.UserProfiles.PersonalSiteCreateException: A failure was encountered while attempting to create the site. ---> Microsoft.SharePoint.SPException: User cannot be found .
   at Microsoft.SharePoint.Administration.SPSiteCollection.Add(SPContentDatabase database, String siteUrl, String title, String description, UInt32 nLCID, String webTemplate, String ownerLogin, String ownerName, String ownerEmail, String secondaryContactLogin, String secondaryContactName, String secondaryContactEmail, String quotaTemplate, String sscRootWebUrl, Boolean useHostHeaderAsSiteName)
   at Microsoft.SharePoint.Administration.SPSiteCollection.Add(String siteUrl, String title, String description, UInt32 nLCID, String webTemplate, String ownerLogin, String ownerName, String ownerE

Hide Site Actions menu for few groups on a specific aspx page.


Hi All Gurus,

I am facing a issue. I want to hide the site actions menu to few groups, which have high level permission on other pages but they dont need to access "site actions" link on only this page.

Can some one tell me a why using Javascript or some quci fix for this in SPD level.

Pls looking forward for your help...

Happy Sharepointing..


Creating a feature that will recreate a existing site with all it's subsite content


i have a site saye http://intranet

under that site i have http://intranet/eng


now i have to create a Feature that once activated will recreate the same site http://intranet and its subsites http://intranet/eng

http://intranet/IT with all its contents

in another site collection in the same FARM.

Any suggestions that will help me here 

Feature Stapling + on creation of a new site stapling is not effecting + means The resource cannot b



i am working on feature stapling. pls find the code below:

http://www.beckybertram.com/oldblog/index.php?p=33&more=1&c=1&tb=1&pb=1  (i had written the code from this site).

after delpoyment of this solution.

problem: while i am creating a site - it is throwing " The resource cannot be found" error.

on log - file not found.

Very 1st site collection is able to apply. but while i am creating newly (after processing , it is thorwing this issue).

pls help me to make this work, i need to complete this by EOD. pls help me.

Automating Site Creation and Feature Activation with PowerShell


I am trying to create a blank site and then loop through the available features for that site and activate them. The problem I am facing is the list of features scoped to "web" that are returned in powershell are not the same list of web features that are visible through the site settings in the SharePoint UI or through the SharePoint 2010 Manager UI.

What I get returned from Powershell is:

DisplayName Id

----------- --

WebPageLibrary 00bfea71-c796-4402-9f2f-0eb9a6e71b18

IssuesList 00bfea71-5932-4f9c-ad71-1557e5751100

WorkflowHistoryList 00bfea71-4ea5-48d4-a4ad-305cf7030140

NoCodeWorkflowLibrary 00bfea71-f600-43f6-a895-40c0de7b0117

SurveysList 00bfea71-eb8a-40b1-80c7-506be7590102

GridList 00bfea71-3a1d-41d3-a0ee-651d11570120

GanttTasksList 00bfea71-513d-4ca0-96c2-6a47775c0119

LinksList 00bfea71-2062-426c-90bf-714c59600103

MobilityRedirect f41cc668-37e5-4743-b4a8-74d1db3fd8a4

workflowProcessList 00bfea71-2d77-4a75-9fca-76516689e21a

TasksList 00bfea71-a83e-497e-9ba0-7a5c597d0107

TeamCollab 00bfea71-4ea5-48d4-a4ad-7ea5c011abe5

AnnouncementsList 00bfea71-d1ce-42de-9c63-a44004ce0104

ObaSimpleSolution d250636f-0a26-4019-8425-a5232d592c01

PictureLibrary 00bfea71-52d4-45b3-b544-b1c71b620109

ContactsList 00bfea71-7e6d-4186-9ba8-c047ac750105

Weird error when creating a site from a feature receiver


Hello everybody

I'm writing a feature in a sandboxed solution (scope of the feature : Web)

I've added to that feature a feature receiver that is supposed to create a subsite in the site in which it has been activated.

Here is the code

public override void FeatureActivated(SPFeatureReceiverProperties properties)
      string url="";
      using (SPWeb site = properties.Feature.Parent as SPWeb)
          site.Title = "root";
          SPWebTemplateCollection webTemplates = site.Site.RootWeb.GetAvailableWebTemplates(site.Language);
          url = site.IsRootWeb ? "subnews" : site.ServerRelativeUrl.Substring(1) + "/subnews";
          SPWebTemplate webTemplate = (from SPWebTemplate t
                         in webTemplates

Create web site specific to mobile device, how to detect?



I have a website that is written in .Net 2.0 which uses all the nice rich functionality of the web (Ajax, javascript etc..).  However I have noticed that the site does not display very well on mobile devices. 

So therefore I would like to create a more streamlined version of my site that is better tailored to these devices.  However how do detect that the user has come to the site via a mobile device and how can i redirect them to my tailored page

Many thanks in advance

Why do the aks master pages not get applied if the feature is not activated on the top site collecti


I installed AKS 2.0 and activated AKS feature. The problem I found was the aks master pages do not get applied if the feature is not activated on the top site collection. why is so?

example: If i activate the feature on http://<servername>/sites/<sitename> and apply the master page, I dont see any changes.

              But if i activate the same aks feature on http://<servername/ then everything started working on all sites.

              The reason i found is the CSS reference in the aks master pages.

              It reference should be given as follows:

                 for http://<servername>/sites/<sitename> ->  <link rel="stylesheet" type="text/css" href="../../Style%20Library/AKS/Aks_Band_Blueband.css"/>

                 for http://<servername>/ -><link rel="stylesheet" type="text/css" href="/Style%20Library/AKS/Aks_Band_Blueband.css"/>

So my question is, am i missing anything? am i supposed to activate the AKS feature on top level site collection at any cost? if yes, why is so? 

And after applying aks master pages, i see differnece in font sizes. Why the font size is getting changed?


Why feature with event receiver doesn't activate properly after site provisioning?



I have defined feature with event receivers for my document library and for users List .

I try to activate my feature in onet.xml in section <WebFeatures>. After provisioning a new site from onet.xml  all work fine and my feature is shown as activated, but event receivers doesn't fire. It fires only after reactivating my feature (deactivate, then activate it again). But I need my feature works immediately after site provisioning without deactivating and activating it again. Who knows how to solve this problem?

part of ONET.xml



        <Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5"/>

        <!-- TeamCollab Feature -->

        <Feature ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4"/>

        <!-- MobilityRedirect -->

        <!--My EventReceivers Feature-->

        <Feature ID ="41178843-A6A4-47c7-9EF9-B8A432E02B88"></Feature>





Programmatically creating a SharePoint Site based on user input


I am working on developing a “Create Website Wizard” for SharePoint 2007 that would do the following (I am simplifying a little for the sake of this post):


1.      Take user input as follows:



Product Code:

Category (I, II, III):

The category will be a choice field (radio buttons or a dropdown)

C# - Creating web client for automating user activity on a HTTPS site

I've been wracking my brain for a couple of weeks on this.  I need to create a web client (I don't want to use the webBrowser control because I need this to be as lightweight as possible) to log in to a secure web site, and then effectively click links and fill in fields to get the data that would normally be displayed in the web browser.  I'm then going to parse the data and perform other actions with it. I have been working with HttpWebRequest and HttpWebResponse and many permutations of suggestions I have found while Googling my issue, but I can't get rid of my problem:  Sometimes when I effictively click the ultimate link that I need to click to get to my data, I get what I am looking for.  However, MOST of the timel, I get a response page that tells me my connection timed out and that I need to log in again.  I have tried messing with cookies and such, but to no avail. I know it's good form to post my code, but it is so sloppy and screwed up right now from tweaking this and trying that, that I'd rather not take the approach of fixing what's there, rather I'd like to start with solid, clean code to begin with. Your help will be greatly appreciated. Thanks, ALo

User Alert Management for a specific list versus entire SharePoint site?

It seems that to be able to manage User Alerts, one must have Full Access to the entire SharePoint site - and then use => Site Settings > User Alerts. Ideally, I would like to be able to grant access to users to only be able to manage alerts for a specific list. Is this possible (without having to do any programming) and, if so, how? If such access is only available at the site level, I will simply create a Permission Level that allows one to only "Manage Alerts" Thanks in advance for any assistance. Dave

Creating a new root Site Collection using a custom site definition file (ONET.XML)

Using Powershell, I am trying to deploy the our custom solution to SP 2010.  The script is doing the following: Deleting the web application using Remove-SPWebApplication Creating a new web application using New-SPWebApplication Adding and deploying a series of WSP files (one of which has the site definition file in it) using Add-SPSolution and Install-SPSolution Create a root site collection based on the site definition file provided in the WSPs using New-SPSite I get the error "WARNING: Template is not found and is not applied." When I run Get-SPWebTemplate, my site definition does not show up. I saw this: http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/5ea46e07-a4b0-4bab-b698-9b6eeb695607 but I want a solution that does not involve me reloading a DLL, as, I feel there is something else I am forgetting. I have also tried: IISReset Resetting the timer service Cleaning the Cache (as described here: http://support.microsoft.com/kb/939308) Nothing seems to work.  Does anyone have any ideas?

Setting Managed MetaData default values on site creation

I am working on a project where the requirement is to have specific document content types.  I have therefore create a site columns feature which creates all my columns, I have a Site Contentypes feature which creates all my content type and I have list templates based on my content types.  I also have created a couple of Site definition features which create specific list instance based on my list template As part of my content types I have created a few Managed Metadata fields which I wanted to set defaults for on the creation of my sites.  I have therefore created a feature which is right at the end of the WebFeatures section in my ONET.xml.  This features enumerates through all lists, looking for specific column names(managed metadata columns) and looks to set these to specific values.  The code to set the default value on the field is: TaxonomyField documentCategoryField = (TaxonomyField)library.Fields["Document Category"]; if (documentCategoryTerm != null) { documentCategoryField.DefaultValue = documentLibraryDefault.ToString(); documentCategoryField.Update();                                                     }                         &n

In Sharepoint 2007 while creating a group "Give Group Permission to this Site" section is missing

I have a strange anamoly in Sharepoint 2007 but I am guessing I am missing some minor step since I am new to Sharepoint. I am trying to create a new group which I have done before successfully. 1.On the home page of the site,  I click Site Actions, point to Site Settings, and then click People and Groups. 2.On the New menu, I click New Group. 3.Type a name for the group, and then type a brief description of the group's attributes in About Me. 4.I change the owner of the group or click Browse to find an individual's account name. 5.In the Group Settings section, I click the options to specify who can see the members of this group and who can add or remove members. 6.In the Membership Requests section, I click the options (No, No) and no email address entered Here is the problem part: I am supposed to see  the "Give Group Permission to this Site section"  but I see only Create and Cancel buttons.   Can you please help why I do not see  "Give Group Permission to this Site section". Is there another way to assign group permission?
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