Sharepoint 2010 how to create global web part - sharepoint

is it possible for sharepoint 2010 to create global web parts?
I have 10 pages that would use one web part, I want to create one in a library, then drag and drop it in, and when editing one, it updates across all the pages I inserted this web part.

I suppose what you are looking for is proper scoping. When creating a webpart you have a feature for it. When the webpart is added to a farm solution you may set the scope of the feature to be web app level or farm level (those are the global ones). I suppose web application level is the one you will be interested in. Then you may add webpart deployed like this to any number of pages.
To check more about scoping please check those two links:
https://www.pritambaldota.com/understanding-features-and-feature-scope-in-sharepoint-2010/
https://www.red-gate.com/simple-talk/dotnet/net-tools/using-features-and-solutions-to-deploy-your-sharepoint-customizations/

Related

Adding another web part to sharepoint list

I am working on a sharepoint site and i have a number of lists which i would like to add web pages to,
my problem is that when i go to the edit page mode there is only one web part, the main zone so i can only add the pages one on top of the other
but i want to add two pages side by side' i need to add more zones (right,left etc).
is there a way to this without using the sharepoint designer? (i have problems with it since the sharepoint site is 2007 and the office i have is 2013 so i can only use the webpage for it)
Thank you very much for the help.

How to add an application page to a site in SharePoint?

I am an experienced .NET Developer acting as interim SharePoint Developer, and am new to SharePoint. After determining that I need to go with an application page instead of a site page for a new project due to it's complexity and need of custom code behind. Before developing the entire solution, I wanted to tie up the loose ends of my understanding of application page deployments. I need to add this page as a URL on the left side of a Site Collection page (kind of like what happens when adding a subsite to a site page.) I have read about the modules, which seems extremely hacky to me. There must be a better way to develkop a custom page on top of SharePoint without the page being accessible to anyone on the entire site.
EDIT
The application I am wanting to develop on top of SharePoint exists purely for data entry and reporting purposes.
Have you considered using a Webpart?
With a visual webpart which is essencially a usercontrol wrapped in a webpart you can add as much complexity as you want and you also have code behind to hook to events etc.
The benefit of using a webpart is that you can then drop it on a page, and use all OOB sharepoint access controls.
You mention that you want to develop a data entry reporting app. So something you can do is to create a subsite. Look all access to modify pages except to owners. Create all your screens by adding pages to the subsite and dropping webparts on it with the logic you require for each screen.
Also make sure you deploy the werbparts via a web feature that only is activated in your subsite, this way the webparts are only available in that particular subsite.

Storing application specific configuration data in Sharepoint?

I am making a Sharepoint 2010 WebPart with functionality from another Main Web Application.
To develop the Webpart quickly I have imported the business logic assemblies used in the Main Web Application. The Webpart works and pulls application specific configuration information from the Sharepoint web.config file.
Is this the best place to store this information?
If not..
Where/How should the application specific configuration data be stored in Sharepoint?
The config data contains items like locations of web services etc. The data will only need to be edited by system administrators.
Thanks
Web.Config is, IMHO, a terrible place to store this sort of config information - its hard to deploy and hard to change, especially if you're using multiple web front ends.
The recommended way to do this is to use PropertyBag (key/value pairs) through the .Properties of SPFarm, SPWeb.RootWeb (for site collections), SPWeb, SPList etc (depending upon the scope that you need).
MSDN - Managing Custom Configuration Options for a SharePoint Application
There is a production ready code available as part of the
MSDN - The SharePoint Guidance Library
See Hierarchical configuration manager
This gives you programmatic access to read/write these values. If you want to do this without using the guidance library then you would use something like the following code.
SPWeb web = SPContext.Current.Web;
if (web.Properties.ContainsKey("MyProperty"))
string myProperty = web.Properties["MyProperty"];
If you want a UI to allow admins to easily set the values then use something like SharePoint Property Bag Settings
The easiest way to do it is to create sharepoint list visible only to administrator. It can have 3 columns description, title, value. It will store all config values. Also you can add a link to this list to site settings page.
The web config is always a good place. However if you want to change that data you will have to enforce some sort of site recompile which is a pain for end users.
Theres a nice little app/solution on codeplex to do with the property bag value
http://pbs.codeplex.com/
This is a brilliant little app/solution that ties in with your central administration.
It should be inbuilt i think.
Hope this helps.

Setting up default web parts on a Wiki Page from a Web Template in SharePoint 2010?

My team is trying to build out a Web Template which includes an instantiated Wiki Page with some default Web Parts added to it; but we're unable to get this behavior to happen.
In brief, we're looking to add some default.aspx (or Home.aspx, the name is unimportant, just the functionality) to the SitePages directory, GhostableInLibrary; so it's visible to all SiteCollections made from this Web Template.
It is of note that we're basing our Web Collection off the Team Site, and that the Wiki will be the default Home Page for the new site.
Site templates can be used to customize newly created sites except for the top site of a site collection. Since site templates are all managed in site collection's Solution gallary, so a site template CAN'T be used to define its own container.
You need a Site Definition to customize the first site of your site collection.
For how to use site template, you can goto, http://weblogs.asp.net/soever/archive/2009/10/19/sharepoint-2010-site-exporting-as-wsp-solution-part-1.aspx
For how to create a site definition, you can goto, http://msdn.microsoft.com/en-us/library/gg276356.aspx
If you want to strap onto an existing template without creating a new copy, or you don't have the original site template to access. You use a process called feature stapling.
When you create a sharepoint solution it would contain two features, one for your actual functionality and one that simple staples it to an existing template.
Here is an article discussing it some more. http://mssharepointtips.com/tip.asp?id=1065

Deploying site pages in SharePoint

I have around 9 web parts and 3 pages to be deployed. Each page will be having 3 webparts.
From a deploymnet perspective, i think i have the following two options:
Deploy the pages using a feature. The pages will have webparts present.
Create a custom site definition with a document library and have the three pages as part of the document library.
Can you please let me know which one of the options is better or is there any better solution?.
Please note that the solution needs to work on WSS 3.0 as well.
I would code the whole thing as a feature. You can staple it to the site definition for the site type you want it activated on.
If ever you need to migrate to the next version of SharePoint or another server it is easier to not have any custom site definitions. Also, the features leaves the site in a normal out-of-the box state; if you ever remove the feature nothing breaks.
Also, unlike the site definition it will also allow you to run it on sites that where created in the past.
First you need to deploy the webparts using WSP. Once it populated in webpart gallery you can copy the pages from page library and can paste in production.

Resources