I have been working on setting up development environment in last two days and have come up with few tips which will definitely make our life easier while developing any sort of SharePoint project. These points are just my thoughts, so if some one has any good ideas then please do leave a comment and I will include in my posts.
I have used two tools and developed some code snippets. I will teach you in my next post on how to create these code snippets for feature.xml, elements.xml, onet.xml or any other xml code that you will need to make your development fast.
The tools that I have used are very familiar STSDEV and Andrew Connel's Project Utility Tool. Now you must have already seen, heard or used these tools. But since both the tools have their drawbacks, so we can use both these tools in sync to suit our needs. You can check above links to know in detail about these tools.
STSDEV: Gives us the flexibility of creating .ddf file, .wsp package, deploying assemblies to GAC, adding SafeControl to web.config on deployment and many build types. But one thing that needs to be done manually in STSDEV is creating folder structure. It does creates a basic RootFiles folder structure for you but if you have to add any more folders which has got a deep tree structure then you have to keep adding it manually. This is where Project Utility Tool plays its role.
Andrew Connel's Project Utility Tool : Also gives us benefit of creating .ddf file, .wsp package and more. But it has its drawbacks of not being able to handle any changes in .ddf file manually and some more stuff that STSDEV gives. So we will use this tool for generating the folder structure in a project that STSDEV has created.
I am not really commenting here on which is a good tool or a bad tool. I am really giving you an idea to utilise best of the outcomes of both tools and increase your efficiency and performance in developing custom SharePoint solutions. We really don't want to waste our time in doing repeated things when developing a SharePoint solution so why not use these beautiful tools which makes our life easier.
And also, I am not saying this is the best way to create and maintain Visual Studio projects for SharePoint solutions. If anybody has got any different idea then please do mention it here and share the knowledge among MOSS geeks :-)
Sunday, July 6, 2008
Friday, July 4, 2008
Disabling unrequired Services in Windows 2003
I know this post is not relevant to SharePoint as such but will tell you on how you can improve the server security and performance.
There are around more than 100 services that run on a Windows 2003 Server. Some of these services might be useful and some may not be. So why not disable them rather than letting them chew your server resources. There are five basic service that you can quickly think of disabling. These are listed below:
1. ERSvc - Error Reporting Service (Used for reporting application crashes to Microsoft)
2. HidServ - Human Interface Device Access (Used for other smart devices, which you might not use on a server)
3. IsmServ - Intersite Messaging (Used for sending messages from server to server)
4. ScardSvr - Smart Card Access
5. LMHosts - TCP/IP NetBIOS Helper
Now these services are just the start. There is a list of other services that you can check, if you really need them. TechRepublic gives you such list. You can downlowd it from here.
Hope this might be helpful in some instances. Like you can disable such services on your VPC which you might be using as a development environment.
There are around more than 100 services that run on a Windows 2003 Server. Some of these services might be useful and some may not be. So why not disable them rather than letting them chew your server resources. There are five basic service that you can quickly think of disabling. These are listed below:
1. ERSvc - Error Reporting Service (Used for reporting application crashes to Microsoft)
2. HidServ - Human Interface Device Access (Used for other smart devices, which you might not use on a server)
3. IsmServ - Intersite Messaging (Used for sending messages from server to server)
4. ScardSvr - Smart Card Access
5. LMHosts - TCP/IP NetBIOS Helper
Now these services are just the start. There is a list of other services that you can check, if you really need them. TechRepublic gives you such list. You can downlowd it from here.
Hope this might be helpful in some instances. Like you can disable such services on your VPC which you might be using as a development environment.
Tuesday, July 1, 2008
Custom Site Column in an existing OOTB List or ContentType
Today I will explain you on how to add a custom site column to an existing Out of the box (OOTB) List type or a content type. There will be instances during your project life cycle when you will want to provision a column to a particular List type or content type, for example you want to add a new column "Expert Comments" to a Wiki library. And you also want to provision this column to any new Wiki library created hereafter in the existing site.
Now for adding a new site column to custom list, you can add it directly when provisioning custom List Definition you can learn this here. But if you want to add a site column to already provisioned list you need to do it through object model.
Firstly you need to find the system content type for a List. Every list in in SharePoint uses a content type, either system content type or custom content type. You can view the content type hierarchy here. And you can find an associated content type for a system List using following lines of code in a console app:
I hope that will be of some help to you. If you have any questions related to this concept then feel free to write to me.
Now for adding a new site column to custom list, you can add it directly when provisioning custom List Definition you can learn this here. But if you want to add a site column to already provisioned list you need to do it through object model.
Firstly you need to find the system content type for a List. Every list in in SharePoint uses a content type, either system content type or custom content type. You can view the content type hierarchy here. And you can find an associated content type for a system List using following lines of code in a console app:
using (SPSite site = new SPSite("http://devmoss/)"))
{
using (SPWeb web =
site.OpenWeb())
{//List Content types in a web
foreach (SPContentType ct in web.ContentTypes)
{
Console.WriteLine(ct.Name);
}
Console.WriteLine("-------------------------");//List Content types in a List
SPList list = web.Lists["Posts"];
foreach (SPContentType ctl in list.ContentTypes)
{
Console.WriteLine(ctl.Name);
}
Console.ReadLine();
}
Now once you know the content type of a List in which you wish to add a
custom column, you can use it add a new SPFieldLink to that SPContentType
object. Below is the sample code:
using (SPSite site = new SPSite("http://devmoss001/)"))
{
using (SPWeb web = site.OpenWeb())
{
try
{
string newColumn= "New Column";
//Construct required content type objects
SPContentType wikiContentType = web.ContentTypes["Wiki Page"];
//Check if the site column already exists
if (!web.Fields.ContainsField(newColumn))
{
//If the site column doesn't exist then create a new column and assign it to custom columns group
popularity = web.Fields.Add(newColumn, SPFieldType.Number, true);
SPFieldNumber fieldNum = (SPFieldNumber)web.Fields[newColumn];
fieldNum.Group = "Custom Columns";
fieldNum.Update(true);
}
if (!string.IsNullOrEmpty(newColumn))
{
//Get the field reference of new site column
SPFieldLink fieldLink = new SPFieldLink(web.Fields[newColumn]);
if (fieldLink != null)
{
try
{
//Add the site column to wiki content type
wikiContentType.FieldLinks.Add(fieldLink);
wikiContentType.Update(true);
}
catch (SPContentTypeSealedException ex)
{
}
catch (SPContentTypeReadOnlyException ctEx)
{
}
}
}
}
catch (SPException ex)
{
//Write to Logger
}
}
}
I hope that will be of some help to you. If you have any questions related to this concept then feel free to write to me.
Labels:
Content Type,
Custom Site Column,
List,
SPFieldLink,
Wiki Library
Saturday, June 28, 2008
SharePoint Developers WebCasts
If you are looking for live demos, virtual labs, sample codes and more SharePoint concepts then visit this site. Try to install SilverLight and then see the site to experience something new :-)
http://www.mssharepointdeveloper.com
Watch this site for updates.
http://www.mssharepointdeveloper.com
Watch this site for updates.
Wednesday, June 11, 2008
The virtual path '/_catalogs/masterpage/default.master' maps to another application, which is not allowed.
I have seen lot of users having following error when adding a custom web app in layouts folder and when trying to use default.master page for custom web app pages.
Exception Details: System.ArgumentException: The virtual path '/_catalogs/masterpage/default.master' maps to another application, which is not allowed.
Firstly make sure that you have created your web app correctly and have done all the configurations or settings. For details on doing this please check this great blog post by Roni
And finally if the error occurs then try commenting out the line
'<'authentication mode="Windows" /'>'
in your web app web.config file. This solution has fixed the error for me and for my friends.
Exception Details: System.ArgumentException: The virtual path '/_catalogs/masterpage/default.master' maps to another application, which is not allowed.
Firstly make sure that you have created your web app correctly and have done all the configurations or settings. For details on doing this please check this great blog post by Roni
And finally if the error occurs then try commenting out the line
in your web app web.config file. This solution has fixed the error for me and for my friends.
Saturday, May 31, 2008
MCTS WSS 3.0
It was a great week! I have now successfully completed my WSS 3.0 Application Development
(70-541) certification. Few preparation tips:
-Read Inside WSS 3.0 by Ted Pattison . This is a great book and will give you a very good understanding of the concepts Windows SharePoint Services 3.0.
-I have completed all the Microsoft E-Learning courses mentioned in the program guide of
70-541. There are two collections 5385 and 5392. These collections will help you in understanding concepts further.
-Having hands on experience for 6 months on a project will help you for sure.
-Understand complete SharePoint object model.
-Try creating Site Definition manually, understand Onet.xml completely.
-Play with features, web parts and workflows.
-A little understanding of deployment procedure using solution packages.
(70-541) certification. Few preparation tips:
-Read Inside WSS 3.0 by Ted Pattison . This is a great book and will give you a very good understanding of the concepts Windows SharePoint Services 3.0.
-I have completed all the Microsoft E-Learning courses mentioned in the program guide of
70-541. There are two collections 5385 and 5392. These collections will help you in understanding concepts further.
-Having hands on experience for 6 months on a project will help you for sure.
-Understand complete SharePoint object model.
-Try creating Site Definition manually, understand Onet.xml completely.
-Play with features, web parts and workflows.
-A little understanding of deployment procedure using solution packages.
Wednesday, May 21, 2008
Quick Tip: Web Service to SharePoint Data
If you want to use web services to manipulate data on your SharePoint site, you must always allow unsafe updates on your site and then disable unsafe updates after making changes.
Want to know more on AllowUnsafeUpdates, check this
Want to know more on AllowUnsafeUpdates, check this
Subscribe to:
Posts (Atom)
