You can almost do anything you want in the FeatureActivated event, same as you would using PowerShell or Central Admin. First you have to determine your feature's scope. This will determine your Feature's parent in the event handle whether it would be of type SPWeb[^] or SPSite[^]. Then you'll use the methods in these classes to do whatever you want to.
Now for your list:
1) Create sub site => Here is a nice article[^]
2) Create Web part pages => Perhaps you mean this?[^]
3) Deploy the web parts => You can add this directly to your feature, which by the way can be visual and non-visual
4) Add web part pages in the corresponding pages => Here is a sample article[^]
5) Create list. => You can add this directly to your feature
If it is a one time deal I would suggest using powershell. Most of time I actually build out the steps within a feature because you have intellisense and it is just easier. Then when I am sure that the feature is working, I convert it into a Powershell script.
That is true. But there are limitations to features.
1. You cannot configure a feature. You can only simply turn it on and off.
Well what if you wanted the administrator who deploys the solution and wants change the name of the "sub site" or what if you wanted the administrator to dynamically add and remove the number of "sub sites" that should be created on deployment. You cannot do that with a feature. Sometimes all information is not known when creating functionality.
2. You have maintenance issues. Say a web feature (say FeatureA) that when you turn it on creates a list (say ListA). Sounds great. You even make it so that list can only appear on the root of the site collection. O Ya
That feature is still present in ALL web sites within the farm/web application that you deployed it to. This means that any web administrator (they do not have to be a site collection administrator) can activate that feature on other site collections. Well, you say "so what. Thats not a problem". Well you then leave the company and the company is rearranging their portal. They decide to get rid of ListA because its no longer needed. So they deactivate the feature on the root site collection and remove the solution. O, but wait, what about the feature that some web administrator was playing around with in a different site collection. Now that list may not have a list definition. You are now getting calls from random web administrators say they can no longer get to "View All Site Content". The list definition that was removed was actually being used. Thats just great!!!
3. Feature Nightmare? Say you create 100's of these features over the years that simply create lists. These features are now all within all your site collection features and web site features when they do not need to be. WHY IN THE WORLD IS THERE A FEATURE FOR CREATING A LIST, WHEN IT IS JUST A ONE TIME DEAL WITH POWERSHELL!!!!For example, I am seeing features to create a "Toyota List 1", "Toyota List 2", "Toyota List 3" in my "GMC" site collection. Well what if you had a toyota site collection, GMC site collection, Ford site collection, and 40 other site collection. What a nightmare this could be for maintaining features which could confuse site collection administrators.
I would say carefully analyize you business requirements and make a proper decision as to whether or not powershell should be used or a feature should be used. Features are easier but could have drawbacks. I said create the initial solution as a feature because I find it is often easier to build and debug. Then, converting to powershell is pretty simple. "Horribly inefficient"...maybe...or it may be just a better decision for a person who may be inexperienced with PowerShell and has a firm grasp of the business requirements.
You can use properties in a feature that can be set via PowerShell.
The other scenarios are, IMO, contrived. What you describe are "what if" cases you are using to justify your process and can be controlled and mitigated with proper governance policies and coding of features, such as handle issues in the DeactivateFeature event. One off lists are created via the SharePoint UI or SPD. Features are used for reusable solutions. Features that should not be activated by site admins can be hidden and activated via PowerShell. There is no valid reason to code the feature in VS then recreate it in PowerShell.
If you have 100s of features being deployed and activated by Site Admins, just because they see them available, then you have bigger problems that need solved.
Failure is not an option; it's the default selection.
I didn't know you could set properties on a feature via powershell. That is pretty cool.
I think we are going to just have to agree to disagree with the coding it within VS then recreate it in PowerShell. If you are experience with PowerShell, then yes, simply create it only in PowerShell. However, if you are new to PowerShell and dont know the syntax, then do it in VS first, then convert it to PowerShell. An inexperience PowerShell developer could easily learn how to convert simple C# syntax into PowerShell.
In my experience, when I was trying to configure search for a SharePoint environment, I wanted to use PowerShell. I started off doing it in PowerShell and I could not figure out how to initially code it without any intellisense. Yes PowerGui does offer some intellisense but not for the deep search configurations. Therefore, I created it in VS first. It was even difficult to do within VS. I finally got it to work inside VS and then moved it to a Powershell script.
First off, please bear with me. My question concerns more specifically with custom lists, custom code inside Sharepoint 2007. My experience is more with applications that work outside but access data (Client Object Model) in Sharepoint 2010.
At work I was recently tasked with the following request:
- Create a custom announcement board where everyone can create an announcement but only admins and creators can edit it.
- The main list page was going to provide a summary of the details, title and an icon that depicts the type of announcement (gif of a baby if birth announcement).
- Upon clicking on an announcement, a detailed page containing more detail of the announcement and up to 4 pictures will be displayed.
- When entering data the pictures can only be a maximum size.
I'm new to Sharepoint so I may not use the correct terminology - please bare with me.
I have a SharePoint 2010 hosted site that I need to stream a video from. The video will be duplicated in several locations and depending on the view's I.P, it should be streamed from a specific location. This is for an intranet Site at Head Office but we don't want all the units to be streaming from H.O so I want to create a conditional stream and have the videos streamed locally.
SharePoint is a great application framework but it isn't right for everything. My initial impression is what you are asking to do may be better suited for a different tool, such as ASP.NET, or consider re-evaluating the requirements.
First of all, your best bet is Silverlight video streaming -even though you can host Flash videos in SharePoint-. If you have SharePoint Server -not foundation- then there should be a web part for hosting Silverlight objects, which you can use to play the videos.
Moreover the video itself shouldn't necessarily be hosted in a SharePoint list- though it can-. If you have access to the underlying IIS you can use the new IIS smooth streaming feature[^], or even host your video anywhere and on any service -including YouTube-. If you have a large number of videos or concerned about performance issues you can even host your file on another server and play it through your SharePoint site. Check this article[^] out.
Can anyone help me? What I need to do is in a wcf web method I need to iterate a sharepoint list and pass the content out to an asp application in the form of xml. What is the best way to do this. Any code samples would be great!
i want to construct employee portal using sharepoint 2007 ,i need to capture the user ID of the windows user loged into the Portal and use that to enable the employee to request about his own data.
How can this be done with the webarts delivered with the employee portal ?
I am using console application to retrieve search results in data table. previously this code was working fine with SharePoint search service application. by the time SSA has been replaced with FAST search using a connector.(Connector is having Content source defined in it.)
My issue is my already working code stopped working, i am using Keyword query.
some where on net I found that I need to set
keywordquery.EnableFQL = true
This I did in my code but it didn't work at all.
Looking forward for solution.
Can any one tell about share point.
I would like to know where we are mostly using this Share point.
At time we need to think about to use this technology
like this my doubts
Help me to learn this,any one have link about this provide me