Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3

Today I ran into more issue when working with deployment of my very first Web Part using Visual Studio 2008 on a 64bit Windows 2008 OS. One important tip when trying to deploy using a SharePoint WebPart for within Visual Studio as that you MUST add the VSeWSS user to the Sit Collections Administrators list. By default that will be just the Primary and Secondary admins of the Site Collection.

Note that you will probably only run into this issue if you have installed Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3 WITHOUT first creating the VSeWSS Application Pool. Please refer to the Release Notes as it will explain how to add the VSeWSS local user to all the required groups.

CAUTION: if you come across a post on the web that tells you to run this comment, then be VERY CAREFULL as it will knock-out your 64bit WSS SharePoint Web Applications if that's what you have: cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1. Only Enable 32-bit on the VSeWSS App Pool.

Hope you have as much fun as I did, but it is great when I was finally able to deploy from within Visual Studio. 

aspnet_regiis -ga domain\user

I was trying to run "aspnet_regiis -ga domain\user" from the command prompt today, but it wouldn't work! I was trying to add calsvdafran03\VSeWSS local user to IIS 7.0 on Windows 2008 Server so that I could take advantage of Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3. The 64 bit version that is. Anyway, I ran into difficulties running it and then discovered that I had to navigate to the C:\Windows\Microsoft.NET\Framework64\v2.0.50727 directory in order to successfully execute the command.

 

Create a Content Database for a New Site Collection

I have recently wanted to create individual Content Databases for each new Site Collection that I add to a Web Application. This is excellent for keeping the content separate for backup and restore purposes. If you ever need to restore content then this is the best solution as you will just be restoring ONE Site Collection and not the entire Web Application.

Just as a precuror to this topic, this is what is stored in a Content Database.

  • All documents, news, links, contacts, calendars, and so on.
  • All Web Parts and their settings.
  • All customizations of sites done with SharePoint Designer.

So we are starting with a single Web Application with it's top level Site Collection. This is the Site Collection that is listed a "/" in the Site Collection List via Central Admin. My Top Level Content Database Name is WSS_Content. I now want to create a new Site Collection under /sites/ called sc1, so the first thing I do is create a new Content Database. Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases. Then click on Add a Content database. Once in the next screen ensure that you have the correct Web Application selected, if not then change it now. The only thing you should change in this screen in the Database Name. I usually name the Database WSS_Content_[SiteCollectionName], replacing [SiteCollectionName] with whatever you want.

IMPORTANT STEP: Now put all OTHER Content databases OFFLINE.

Once that is done you will see that the Current Number of Sites is ZERO. Now all you have to do is create a New Site Collection via Central Admin -> Application Management -> SharePoint Site Management -> Create Site Collection for the Web Application you need and there you have it! The New Site Collection latches onto the vacant Content Database. You can double check that by going into the Site Collection List and selecting the new Site Collection that was just created.

COMMENTS: If you do not create a new Content Database first, then the New Site Collection will use the top level Content Database by default, which is fine if that's what you want. Give it a go!

Hope this Helps someone!
Dave Stuart

Convert a Sub-Site into a Site Collection

Have you ever wanted to move a subsite from a top level site into it's own Site Collection with it's very own Content Database? I have, and just recently I was able to do this with some help from other blogs, so here is how you do it in SIX simple steps.

STEP ONE: Export the subsite using the following stsadm command. Subsititue the url, filename and versions as required. This may create several files if there is a good amount of data.
stsadm -o export -url http://www.mytopsite.com/subsite -filename c:\subsite.cab -versions 4

STEP TWO: Create a new content database for your new site collection from Central Admin. Navigate to Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases. Then click on Add a Content database. Once in the next screen ensure that you have the correct Web Appplication selected, if not then change it now. The only thing you should change in this screen in the Database Name. I usually name the Database WSS_Content_[SiteCollectionName], replacing [SiteCollectionName] with whatever you want.

STEP THREE: Put all content databases in Offline mode except for the one you want your new site to use. You do this via Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases. Click on each Content database, change the Database status to Offline and click OK.

STEP FOUR: Create a new Site Collection via Central Admin -> Application Management -> SharePoint Site Management -> Create Site Collection. Make sure that the correct Web Application is selected, if not then change it now. Enter the Title, Description and the Site Collection name in the box after /sites/. Don't use any spaces. For this example I will use sc1. Also set the template to blank, but I don't think this matters. Finally, ensure a farm account is used for the secondary Admin of the new Site Collection.

STEP FIVE: Import the subsite exported earlier into the new Site Collection at the stsadm command using the following command.
stsadm -o import -url http://www.mytopsite.com/sites/sc1 -filename c:\subsite.cab 

STEP SIX: Go back into Central Admin and put all Content Databases back Online. Done! Well almost done. You should now go back to the Subsite that you just copied (http://www.mytopsite.com/subsite), ensure that the site does not inherit permission from it's parent, then remove all the security so that no-one can see it except for the Admins. Once you are happy with the new Site Collection (http://www.mytopsite.com/sites/sc1) it will be safe to delete the original Subsite. Finally, make sure you tell your users about the new URL to their new Site Collection.

COMMENTS: One thing that is not copied over is permissions, so you will have to redo these, however you now have a New Site Collection with it's own Content Database and Security!

I hope that someone finds this as useful as I did when I had to do the exact same thing just last week.

Thanks
Dave Stuart

WSS Anonymous Access Set-up and what NOT to do!

Setting up Anonymous Access in WSS is a TWO step process! If you want to undo the 2 step process then you MUST follow the 2 steps in reverse order, otherwise you will find yourself with a site that allows any Domain User read access, which will result in frustration. I recently fell into this trap so I wanted to share this with fellow bloggers and those who seek the answers when they're in a jam, like I was. This is the reason why I have started to blog again, since I could not find the answer to this issue on the web.

STEP ONE: Switch ON Anonymous Access via Central Admin so that you can actually see the Anonymous Access Menu option in Site Settings -> Site Permissions in the site itself. To do this you need to navigate to Central Administration -> Application Management -> Authentication Providers (Default) -> Edit Authentication and swith ON Anonymous Access by checking the box.

STEP TWO: Then go into to the Anonymous Access Menu option in Site Settings -> Site Permissions Menu option and set it to "Entire Site". By Default this will be set to "Nothing".

Close the Browser and launch the site again. You will now be able to see the site and it's content with a "Log In" to the top right, which is for Admins or Contributers. Now, let's say that you want to stop sharing your site and force users to login, hence not allowing unauthenticated users seeing the site content. This is where it caught me out! Initially, I did not set-up the Anonymous Access and never knew about the TWO step process, so I simply went into Central Admin and switched Anonymous Access OFF. This caused so much pain as doing this hides the Anonymous Access Menu option as mentioned above. I could not understand why anyone and everyone in Active Directory could log into the site and view the content. This was the case even if you have WSS on a Domain Controller or not, which is something I tested once I discovered the issue.

I only discovered the issue when I added a 2nd Sub-Site only to see that ANY user could see that site too, even if I stopped inheriting permissions from the parent site!!

So, to make sure your site is fully secure again you must do the following.

STEP ONE: Go into to the Anonymous Access Menu option in Site Settings -> Site Permissions Menu option and set it to "Nothing".

STEP TWO: Switch OFF Anonymous Access via Central Admin so that the Anonymous Access Menu option in Site Settings -> Site Permissions is hidden. To do this you need to navigate to Central Administration -> Application Management -> Authentication Providers (Default) -> Edit Authentication and swith OFF Anonymous Access by un-checking the box.

Problem Solved! I put this down to inexperience with WSS/SharePoint Security (ME that is!) at the same time as taking over the site from someone else who had switched on Anonymous Access using the TWO step process. I thought that switching OFF Anonymous Access in Central Admin was enough, however I didn't know it was a 2 step process that can only be reversed by performing 2 steps in the opposite way as described above.

I read about the solution in this book: http://www.amazon.com/Real-World-SharePoint-2007-Indispensable/dp/0470168358/ref=sr_1_1?ie=UTF8&qid=1289880110&sr=8-1> 

I hope that someone else out there finds this to be useful information.

All the Best
Dave Stuart