I'm creating a sharepoint project with custom webpart that includes custom user controls.
Is there any way to include a web.config file in this project?
Some of the references I'm including use the web.config file.
Thanks
You can use Property bags for storing configuration settings. Take a look on this post.
You have several options to work with the Property Bags:
SharePoint Designer
PowerShell
Custom code
Codeplex solutions (as SharePoint Property Bag Settings, that provides a farm solution to work with the Property Bag using the SharePoint UI).
So, I believe there is no way.
You have to include your entries in the SharePoint web.config file.
The correct way is not to use a web.config, but if you really need it then use the SharePoint web.config.
Related
by Default there are Themes, I don't Like those. How can I modify It completely and make a professional website. I have found same Questions on this blog but all for MOSS2007. I am working on Sharepoint 2010
The way I modify sharepoint, is as I do with almost every other CMS out there combined with the power of asp .Net (Remember that as CMS' go sharepoint is a poor solution if the only thing you want is a portal. Sharepoint is first and foremost a BI Solution).
When you edit your site in sharepoint designer (Site Action -> Edit in sharepoint designer) you can see a whole lot of options.
Here you can change the default masterpage to accomodate the look and feel of your site. You will do most of the hiding stuff here (those you don't want to be seen giving them the visibility=false attribute). Here you can also include a new CSS (place it in site assets) where you can override already existing css files.
From this point on, you will be able to add web pages to the site, that will conform to the masterpage, and thus you can use all the sharepoint power (web parts and even embedded html code) keeping the look and feel you have implemented on your master page.
So what you need to do is:
Modify master page in sharepoint designer
Add css files in site assets and include them in your masterpage
Add any other aspx pages or custom web parts that you will refer to in the sharepoint site
Create web pages with sharepoint assets, web parts or custom code
Enable anonymous access for the people you want to view your portal without authenticating (Bear in mind that there are some sharepoint controls that can only be viewed by logged in users)
There are multiple ways of customizing it.
My perfered way is CSS.
Add reference to a custom css in master page using feature
Modify the look and feel by modifying sharepoint out-of-box CSS
Following resources gives all the details of SharePoint 2010 css classes.
http://sp2010notes.wordpress.com/sharepoint-2010-css-chart/
http://sharepointexperience.com/csschart/csschart.html
I hope it helps.
Cheers.
Rajendra Shekhawat
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.
I have developed a publishing portal in sharepoint.I have a requirement wherein I need to create sitemap for the entire web application.
This should be dynamic, in the sense, whenever we update the contents of any given page in our web application, it should be reflected immediately in the sitemap page. What are the possible ways to achieve this and which is the best possible solution considering the scalability and easy configuration?
Thank you.
If you don't want to use a custom webpart, you could use normal navigation list to create your sitemap and it is automatically updated. You only need to style it in a way to resemble some kind of sitemap.
Here are some links to get you started with customizing your navigation:
Custom Navigation in SharePoint - The Full Monty
How to: Customize Navigation
Also there is the portal site map which provides the data source for your custom menu. Just read up on custom navigation and stuff like PublishingNavigation:PortalSiteMapDataSource and SharePoint:AspMenu.
There is a nice PowerShell script to create a sitemap for SHarepoint 2010, if you want to submit your sitemap to Google: Generate A Sitemap For SharePoint 2010 Using PowerShell'.
You can also install and customize the SharePoint Web part ("Table of Contents") to your liking. Read up on it here...
Take a look at our ECS product, it is close to what you need
http://www.infowisesolutions.com/product.aspx?id=ECS
It was built as a system of cross site collection navigation, with security trimming and permissions inheritance between site collection.
I have a sharepoint webpart that will exist on many pages. The webpart has a custom editor control that I have developed to present the configuration options to the user in a more friendly manner.
Although there will be many instances of the webpart I require that each instance has the same consistent set of property values.
Is there a way using webparts to define a property as a site level configuration element rather than the current default / per page configuration?
Store your settings in the property bag of the site/farm. for instance SPFarm.Local.Properties.
SO - What is a proper way to store site-level global variables in a SharePoint site?
Includes references to MSDN articles explaining how to use the farm/site level property bags and the Hierarchical Configuration manager that's included in Microsoft reference "SharePoint Guidance Library"
This might be bit non programming related but thought to add it here.
I am working on a code that retrieves the Property bags from the Sharepoint server. Now I need to test it. In order to do that I need to associate some custom properties with sharepoint objects. (i.e Add property bags)
How can I do that manually in sharepoint. Honestly I prefer to do it manually not using a code. Using a code for it may raise some unnecessary complexities.
Any help/link would be appreciated.
Thanks
You can access a website's property bag via SharePoint Designer. Open the website with SharePoint Designer, then open the "Site" menu and chose "Site settings ...". There you'll find a "Parameters" tab showing the website's property bag.
CodePlex has a solution for settings up Property Bags. Try this link, i have tried this. All you need to do is set the property through the central admin. you can target any of the web application in the farm. Pretty neat ;-)
http://www.codeplex.com/pbs
let me know how it went :-)