Site Template
The first option for getting the SharePoint Designer changes beyond the current site is to take the site you've modified with SharePoint designer and save it as a template. Then when you need a new site you create it from the site template you've created. This approach works but it means that you either have to create a new site template for each of the built in site definitions -- or you have to live with just the one site template that you've created. It also means that you can't go back and apply the changes after they've been created.
Finally, to add insult to injury, if you ever change the work that you did on the original site those changes won't be reflected across the other SharePoint sites that were created from the template because each page exists separately in the database. So site templates solve the problem of getting SharePoint Designer changes into multiple sites but without the ability to adapt to changes in the future.
Site Definitions
solve the problem of site templates in that changes can be affected to them after they've been created -- but at the cost of additional work. Site definitions exist on the file system of each of the front end web server unlike site templates which exist in the content database. Each site which is created from the site definition doesn't make a copy of the page in the database, instead it stores a pointer to the site definition file. The good news is that when the page on the file system changes it changes all of the references in the database -- thus solving the problem of making changes to existing branding.
In order to do a site definition, you'll first have to get the changes to the files that you want into files. You can do this from SharePoint Designer by selecting Save As and pointing to a directory. From there you have to create the support files for the site definition including the ONET.XML file which drives how the site definition is used, and the WEBTEMP*.XML file which makes the site definition show up as an option. In most cases you'll copy the STS site definition that comes with SharePoint and make your changes there rather than starting from scratch.
Wednesday, July 23, 2008
Monday, July 16, 2007
Creating a site using object model in forms authentication
Recently we had new requirement to create a blog in share point site from Asp.net Application.
The Share Point site is in Forms authentication. To Create the blog site
public void CreateSite(string strSiteURL,string strSiteTitle)
{
//Create a new SPSite object corresponding to your top level site
SPSite newSite = new SPSite(“http://moss/site”);
//Create a new SPWeb object from the newSite object
SPWeb newWeb = newSite.OpenWeb();
//Return the collection of sub sites
SPWebCollection subSites = newWeb.Webs;
If the site is blog site the template id is "Blog#0"
SPWeb newSubWeb = subSites.Add(“newsite”, “New Site”, “This is the description for my new site.”, 1033, “Blog#0”, true, false);
}
Remember it works in windows authentication, but it fails in forms authentication.
Because forms authentication doesn't have the enough authentication to create a site. It should be Impersonated with windwos credentials.
The Share Point site is in Forms authentication. To Create the blog site
public void CreateSite(string strSiteURL,string strSiteTitle)
{
//Create a new SPSite object corresponding to your top level site
SPSite newSite = new SPSite(“http://moss/site”);
//Create a new SPWeb object from the newSite object
SPWeb newWeb = newSite.OpenWeb();
//Return the collection of sub sites
SPWebCollection subSites = newWeb.Webs;
If the site is blog site the template id is "Blog#0"
SPWeb newSubWeb = subSites.Add(“newsite”, “New Site”, “This is the description for my new site.”, 1033, “Blog#0”, true, false);
}
Remember it works in windows authentication, but it fails in forms authentication.
Because forms authentication doesn't have the enough authentication to create a site. It should be Impersonated with windwos credentials.
- go to central administration ->application management ->Create or Extend Web Application
- click on 'Extend an existing Web application' select the web application for which you enabled forms authentication.create a new IIS Website with zone as Intranet. for ex: http://systemname:1234/
- create an Asp.net webservice(for ex: myService) project and map it to the virtualdirectory of the above port.
- http://systemname:1234/myService.
- In the webservice Paste the above method.
- Add this webservice from asp.net application/webpart as below
- If the webreference is CustdomSite then the code as follows
- The code in asp.net application
- Public void CreateSite()
{
CustdomSite obj=new CustdomSite ();
System.Net.NetworkCredential cred = new NetworkCredential(UserName,Password,Domain); [Import system.Net namespace]
obj.Credentials=System.Net.CredentialCache.DefaultNetworkCredentials;
obj.CreateSite(txtsiteUrl.Text,txtSiteName.Text);
}
Assuming the user knows the Creation,deployement of custom webparts - Important Note: Most of the Object model functionalities in Forms authentication one needs to follow the above process.
Separate css file for each individual site
By Default each site takes the default style as Core.css file (Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\STYLES\core.css).
If we included our custdom classes in core.css that would applied to all sites available in the system. Bcoz its global for all sites in the system.
To apply Site specific Css style
Site Actions -> Site Settings -> Master Page
by default "Use Windows SharePoint Services default styles" is selected. select "Specify a CSS file to be used by this publishing site and all sites that inherit from it" and specify the location of the Css file. Here the changes that you made will be applicable to that particular site only.
If we included our custdom classes in core.css that would applied to all sites available in the system. Bcoz its global for all sites in the system.
To apply Site specific Css style
Site Actions -> Site Settings -> Master Page
by default "Use Windows SharePoint Services default styles" is selected. select "Specify a CSS file to be used by this publishing site and all sites that inherit from it" and specify the location of the Css file. Here the changes that you made will be applicable to that particular site only.
Saturday, July 14, 2007
How Forms Authentication is differ from Windows Authentication in adding users to the Group in object model
When you have forms authentication enabled for your site and adding users to Group is not as simple as you do with windows authentication in object model. In windows authentication to add the users to the group(assumption: the current domain user has the permission to add the user to group) we have In-built webservice http://server/site/_vti_bin/UserGroup.asmx and using AddUserToGroup method from it.
note: here the site should be any windows authentication site.
. But in forms authentication its not going to be work. The reason is that the forms tries to access the http://server/site/_vti_bin/UserGroup.asmx service it will redirect to the login page of the current working site. Bcoz the user is not windows impersonated so he doesn't has the permission to access. The work around is to impersonate webservice with user windows domain credentials. If the webreference name is "GroupUser" follow below steps:
note: here the site should be any windows authentication site.
. But in forms authentication its not going to be work. The reason is that the forms tries to access the http://server/site/_vti_bin/UserGroup.asmx service it will redirect to the login page of the current working site. Bcoz the user is not windows impersonated so he doesn't has the permission to access. The work around is to impersonate webservice with user windows domain credentials. If the webreference name is "GroupUser" follow below steps:
- GroupUser obj=new GroupUser();
- System.Net.NetworkCredential cred = new NetworkCredential(UserName,Password,Domain); [Import system.Net namespace]
- obj.Credentials=System.Net.CredentialCache.DefaultNetworkCredentials;
- Now call the method as obj.AddUserToGroup(groupName As String,userName As String,userLoginName As String,userEmail As String,userNotes As String)
This will work out.
Sunday, July 8, 2007
Moss 2007 Search in Forms Authentication Mode
The out of box feature of Moss 2007 search doesn't works in Forms authentication mode.
To get rid of this problem
go to central administration ->application management ->Create or Extend Web Application
click on 'Extend an existing Web application' select the web application for which you enabled forms authentication.
create a new IIS Website with zone as Intranet. for ex: http://systemname:1234/
now go to shared service administration, create new shared service provider(SSP).
go to SSP->search settings click on Content sources and crawl schedules, click on link
Local Office SharePoint Server sites. In the site addresses box add Intranet site(http://systemname:1234/)
check start full crawl of this content source checkbox and click on ok. It take few minutes to crawl all content of your Site.
That's it now you can search forms word in your forms authentication site.....
To crawl the new content of the site you can set the incremental crawl duration in Local Office SharePoint Server sites.
To get rid of this problem
go to central administration ->application management ->Create or Extend Web Application
click on 'Extend an existing Web application' select the web application for which you enabled forms authentication.
create a new IIS Website with zone as Intranet. for ex: http://systemname:1234/
now go to shared service administration, create new shared service provider(SSP).
go to SSP->search settings click on Content sources and crawl schedules, click on link
Local Office SharePoint Server sites. In the site addresses box add Intranet site(http://systemname:1234/)
check start full crawl of this content source checkbox and click on ok. It take few minutes to crawl all content of your Site.
That's it now you can search forms word in your forms authentication site.....
To crawl the new content of the site you can set the incremental crawl duration in Local Office SharePoint Server sites.
Saturday, July 7, 2007
Moss 2007 Forms authentication
As we know that by default Share point picks the users list from the ActiveDirectory(Windows Authentication). we dont have forms authentication concept in sps3 it was introduced in Moss 2007. To enable forms authentication follow the below steps.
Create aspnetdb database to store all our roles and users. You will find this database installed at 'c:\windows\microsoft.net\framework\v2.0.50727' if you have Visual Studio 2005 installed in your machine. go there and run aspnet_regsql. To Create your roles and membership data on the sql server you need to edit web.config for the site.we need to supply the connection string details for our aspnetdb. Just outside the system.webtag put:

Create aspnetdb database to store all our roles and users. You will find this database installed at 'c:\windows\microsoft.net\framework\v2.0.50727' if you have Visual Studio 2005 installed in your machine. go there and run aspnet_regsql. To Create your roles and membership data on the sql server you need to edit web.config for the site.we need to supply the connection string details for our aspnetdb. Just outside the system.web

and inside the system.web put the following code

Once you’ve edited both web.config’s go to a command prompt and do an iisreset.
Now we need to add some users to our database. The easiest way to do this is to create an ASP.NET 2.0 website using Visual Studio 2005 (or Visual Web Dev). Add a web.config to the project and then add exactly the same connection string as you did above for your new SharePoint site. Build the project.
Back in Visual Studio, under the website menu, select the option for ASP.NET Configuration. This opens up the ASP.NET web site administration tool where we can add the users and roles we want.
Select the Security link, create a role (something like administrators), and then go and add a user.
Now go to Application Management page in Central Admin and click on Authentication Providers. select the site you wish to change the authentication provider to Forms for. Once you've selected it you'll see Windows as the MemberShipProviderName.
Set the authentication type to Forms and enter the Member Ship Provider Name to AspNetSqlMembershipProvider. If anonymous access isn't ticked, tick that now.
Goto Central Administration -> Application Management -> site collection administrators – and enter the username created by the asp.net application.
Now when you try login into the site will redirect to the login page, where you need to provide the credentials of the user that you have created.
Saturday, June 23, 2007
Moss 2007 PDF search
Moss 2007 out box feature doesn't supports the searching of pdf documents. The search is works fare enough in case of word documents and html, aspx pages and blah blah.
search the pdf files one need to install PDF IFilters 6.0 version. But which works only with x32 bit
I had really tough time with my production machine when i came to know that PDF search is not working. I cracked my head even though i had PDF IFilter is in place in Production machine. Its working fine in Development and Testing boxes. I googled a lot and finally i found a solution. Foxit PDF IFilter x64 bit which acts as a plug-in for full-text search engines.
Before intalling make sure that you have done with the following steps. 1. Goto Central Administration 2. Click on shared services and goto Search settings 3. Click on File Types and add new File Type as PDF
Lets see how it works........
Step 1, the search engine go through a designate place, e.g. a file folder or a database, and indexes all documents or newly modified documents, including PDF documents, in the background and create internal data to store indexing result.
Step 2, a user specify some keyword he would like to search and the search engine answer the query immediately by looking up the indexing result and respond to the user with all the documents that contains the keyword.
During Step 1, the search engine itself doesn't understand format of a PDF document. Therefore, it looks in windows registry for an appropriate PDF IFilter and finds the Foxit PDF IFilter. Foxit PDF IFilter understand PDF format. It filters out embedded formatting and extracts text from the document and return text back to the search engine.
Key benefits:
Integrates with existing operating systems and tools within your company
Provides an easy solution to search within PDF documents located on local computer, local network and intranet
Greatly increases your ability to accurately locate information
Much smaller and faster than IFilter offered by other vendors
Support Chinese/Japanese/Korean PDF documents .
Please note that this installer does not register with MOSS 2007 by default. That means that after you install it, MOSS will not use it to index pdf files. This could be fixed manually with some registry tweaking:
After you install the Foxit, add a pdf extension in MOSS search settings Open regedit, locate [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf] Change the default value to {987f8d1a-26e6-4554-b007-6b20e2680632} . (You can get this handler addin value using Citeknet ifilter explorer)
Cmdline: net stop osearch
Cmdline: net start osearch
Do a full crawl.
search the pdf files one need to install PDF IFilters 6.0 version. But which works only with x32 bit
I had really tough time with my production machine when i came to know that PDF search is not working. I cracked my head even though i had PDF IFilter is in place in Production machine. Its working fine in Development and Testing boxes. I googled a lot and finally i found a solution. Foxit PDF IFilter x64 bit which acts as a plug-in for full-text search engines.
Before intalling make sure that you have done with the following steps. 1. Goto Central Administration 2. Click on shared services and goto Search settings 3. Click on File Types and add new File Type as PDF
Lets see how it works........
Step 1, the search engine go through a designate place, e.g. a file folder or a database, and indexes all documents or newly modified documents, including PDF documents, in the background and create internal data to store indexing result.
Step 2, a user specify some keyword he would like to search and the search engine answer the query immediately by looking up the indexing result and respond to the user with all the documents that contains the keyword.
During Step 1, the search engine itself doesn't understand format of a PDF document. Therefore, it looks in windows registry for an appropriate PDF IFilter and finds the Foxit PDF IFilter. Foxit PDF IFilter understand PDF format. It filters out embedded formatting and extracts text from the document and return text back to the search engine.
Key benefits:
Integrates with existing operating systems and tools within your company
Provides an easy solution to search within PDF documents located on local computer, local network and intranet
Greatly increases your ability to accurately locate information
Much smaller and faster than IFilter offered by other vendors
Support Chinese/Japanese/Korean PDF documents .
Please note that this installer does not register with MOSS 2007 by default. That means that after you install it, MOSS will not use it to index pdf files. This could be fixed manually with some registry tweaking:
After you install the Foxit, add a pdf extension in MOSS search settings Open regedit, locate [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf] Change the default value to {987f8d1a-26e6-4554-b007-6b20e2680632} . (You can get this handler addin value using Citeknet ifilter explorer)
Cmdline: net stop osearch
Cmdline: net start osearch
Do a full crawl.
Subscribe to:
Posts (Atom)