Wednesday, December 7, 2011
SharePoint 2007 Issues and Resolutions
Thursday, September 15, 2011
Migrating a SharePoint 2007 Blog to 2010 (Part 2)
Welcome to the 2nd of a 2 part blog series on migrating a SharePoint 2007 blog to SharePoint 2010. This is a continuation of a previous post where I migrating Joel Oleson’s blog which we host to here at Rackspace to SharePoint 2010.
Recap of the upgrade steps:
· Acquire another server
· Install SharePoint 2010
· Perform a “preupgradecheck” on the old server
· Install any prerequisites on the new server
· Migrate the Content DB
· Apply the new look and feel
· Apply Joel’s theme
In the previous post I took you through as far as Migrating the Content DB where we attached Joel’s 2007 content database to a newly built SharePoint 2010 Foundation Server (note the new naming conventions).
Apply new Look and Feel
So at this point everyone is excited to open a browser and take a look at the new site. The only problem is that once the browser opens and renders the site – there isn’t any change to how the site looks…what’s up with that?
In this new version of SharePoint, Microsoft has shipped all of the CSS and Masterpages from 2007 to help ease the transition of sites in 2007 to 2010. In fact what they have also done is increased the delineation of SharePoint responsibilities from the IT Pro and the rest of the SharePoint user base. The beauty of this is that at this point my role as the System Admin is complete – Joel’s blog is now running on 2010 – mission accomplished. It would be at this point that I would had the site over to Joel and his designer to decided when they wanted to apply the 2010 look and feel.
Being that it is my role to help Joel with these things as well (and it helps me with more info for blog posts), I went ahead and completed the process. You see inside: Site Actions > Site Settings under “Title, Description, and appearance” there are these radio-button choices at the bottom of the screen:
- Keep the previous SharePoint user experience.
- Preview the new SharePoint user experience, but let me return to the previous user experience.
- Use the new SharePoint user experience, and don’t ask me again.
Note: If you are tracking along w/ your own DB and following my steps, you may find that you can’t log into your site collection… why you ask? Because if you have built your new farm in a new domain – you have just restored content from an old domain with old domain users. Go add yourself to the Site Collection Administrators in Central Admin.
Apply Joel’s Theme
Once you select “Use the new SharePoint Experience…” you will see an immediate change as your are dropped back in Central Admin – you have the new admin features and layout available! As you go back to your home page, you will see the new theme applied as well.
Now Joel’s page has the new look and feel but all of his styling is gone. This is because the default.master is being fed from the “uncustomized” version of the page which is located on the WFE. To get Joel’s styling back, all we have to do is open SharePoint designer and re-apply the page created by Heather Waterman.
Once that’s done, you are good to go:
So there you have it: Migrating a SharePoint blog from 2007 to 2010. In future posts I’ll dig a little deeper into each of these areas – this post was meant to give you the “big picture” of the process.
Migrating a SharePoint 2007 Blog to 2010 (Part 1)
Some of you may already know that we host the blog site for Joel Oleson at Rackspace. Well Joel was going to be giving a talk at the recent SharePoint Conference on the new world of SharePoint administration in SharePoint 2010. As part of that talk he (and Mike Watson) were going to touch on migrating sites from SharePoint 2007 to 2010. So we came up with this idea that we should migrate his current site live to one running onSharePoint 2010. This post talks about that migration and some of the things that I needed to do in order to perform this migration.
First of all, let’s understand the outline of what needed to be accomplished:
- Acquire another server
- Install SharePoint 2010
- Perform a “preupgradecheck” on the old server
- Install any prerequisites on the new server
- Migrate the Content DB
- Apply the new look and feel
- Apply Joel’s theme
Sure seems simple enough, right? In the end it wasn’t all that hard – but there were a few “gotchas” along the way.
Acquire Another Server
Why did we need another server? There were 2 reasons: Because we wanted both the 2007 and 2010 site to show up simultaneously and because the old hardware was running on 32-bit architecture. As you may remember – SharePoint 2010 requires a 64-bit OS to run.
Install SharePoint 2010
This part was simple enough and to be honest, was another reason why we needed a second server. For this demo, we had already in stalled the bits for 2010 and we couldn’t make this site live before Monday as the NDA from Microsoft was still in place.
Perform an “stsadm –o preupgradecheck”
I can’t stress enough the importance of doing this on your 2007 SP2 (or later) site. This goes through your current site and checks all dependencies to ensure you are ready to go. Here is a screen-capture from Joel’s:
Install any Prerequisites on the Server
This means that any packages (WSP’s, Features…) that are installed on the source server need to be installed on the target server. In Joel’s case, this included the Community Kitfor SharePoint.
Confession: I forget to do this the 1st time I attempted the migration and the upgrade on the content DB failed. Good thing I had another copy of the source content DB (you should too!)
So off to codeplex I went and downloaded the install files. It is certainly nice when a package comes with an INSTALL.BAT but guess what? Any and all of those install files out there have to updated if they drop any files in
c:\program files\common files\microsoft shared\web server extensions\12\*
Know why??? Because in SharePoint 2010 the install directory changes to:
c:\program files\common files\microsoft shared\web server extensions\14\*
After updating their install.bat, all worked well.
Migrate the Content DB
Part of this step does including creating a new site collection. It doesn’t much matter what template you use, as you will be detaching and deleting it’s database. Once you have it created, go into central admin and delete the content DB from the WEB app.
Now, when I made a copy of Joel’s production DB, I just made a SQL Backup of the content. I could have copied the MDF and LDF files and moved them to the new server. But being lazy and only wanting to move one file, I opted for the “backup” method.
So now over on the 2010 server I opened SQL Studio and performed a “restore” of Joel’s content db. Note: you may need to either kill SQL connection or just restart the SQL service.
Now that I had a copy of the Content DB on the new SQL server, it is was time to connect it to SharePoint 2010. To do this, you have to use the command line as the GUI interface can not handle the upgrade. Open a CMD interface and navigate to the BIN directory:
c:\program files\common files\microsoft shared\web server extensions\14\bin
and perform the following:
stsadm –o addcontentdb –url enter your url –databasename enter your db name
The system will churn a bit, give you a little progress info… and hopefully you’ll see a 100%. Now it’s time to navigate to your site and enjoy the goodness of the migrated site. The reality is, you will not see any change! This is actually a good thing – you see SharePoint 2010 does an amazing job of enhancing the line between the IT Pro and the Designer/Developer role. We will talk more about this in the next blog post!
CREATING LIST ITEMS WITH JQUERY AND THE SHAREPOINT WEB SERVICES
In my previous post I showed how to make a call to SharePoint’s Lists.asmx web service with the jQuery library to retrieve information about the Lists and Document Libraries that are available on a specific SharePoint Site. In the comments of that post, one of the readers asked if it would be possible to create a new item in a List using the same technique. Of course this is possible, you just need to make use of the UpdateListItems web method (yeah, the name of that method is not very intuitive). Here is a quick example!
First let’s create the UI (in this example I'll use a basic Site Page) to allow the user to enter a Title for the new task, and a button to do the action.
Task Title:
Next let’s create a Javascript function that will create a new item in a Task list. In the Javascript function I’m declaring two variables that will contain the XML which will be sent to the SharePoint Lists.asmx web service. The first variable (I called it batch) contains the CAML to create a new item. For simplicity the CAML only provides a value for the Title field, add more fields if you’d like. The second variable (called soapEnv) is the SOAP Envelope XML which wraps the batch XML. Notice that in the SOAP Envelope the name of the list is mentioned in which we’re going to create a new item (in this case the Task list). Finally the jQuery ajax function is used to POST the data to the Lists.asmx web service. (If you test this code make sure you update the url option with the URL of your site).
function CreateNewItem(title) {
var batch =
"
var soapEnv =
" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
" + batch + "
$.ajax({
url: "http://yoursite/_vti_bin/lists.asmx",
beforeSend: function(xhr) {
xhr.setRequestHeader("SOAPAction",
"http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
},
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=utf-8"
});
}
The jQuery ajax function call has a complete option which points to a function, in this function you can process the result as follows:
function processResult(xData, status) {
alert(status);
}
The status parameter is a string which can be for example success or error. Finally in the ready event of the document, we'll hook up the click event of the button so the CreateNewItem function is called, with the value of the textbox as the parameter.
$(document).ready(function() {
$("#newTaskButton").click(function() {
CreateNewItem($("#newTaskTitle").val());
});
});
That’s it! If you put all the code in a simple Site Page, upload the page to a Document Library in a SharePoint site, and now you can create Task list items by only using Javascript! The sample code can be downloaded in the following zip file. The zip file also contains the jQuery library which you can upload to the same Document Library if it isn't already loaded with the help of the SmartTools.jQuery component for example.
QUERYING SHAREPOINT LIST ITEMS USING JQUERY
Due to popular demand I’ve created another sample of how you can make use of the jQuery Javascript library in your SharePoint sites. This example uses SharePoint’s Lists.asmx web service to retrieve all the list items of a specific list. In my previous posts I showed how you could use jQuery in SharePoint Site Pages (regular .aspx pages uploaded to a Document Library), so let’s do something different now; let’s use jQuery in a plain Content Editor Web Part.
To try this sample navigate to the home page (usually /default.aspx) of a SharePoint site that has a list with some list items in it, in my code I’ll use the Tasklist of a plain vanilla Team Site. Switch the page to Edit mode (Site Actions, Edit Page), and add a new instance of the Content Editor Web Part to the page. In the properties of that web part, copy and paste the following code using the Source Editor button.
>
On the first line the jQuery library is loaded from googlecode.com. To make this your, your client browser needs to have Internet access of course. Alternativly you can host the jQuery library yourself (see my previous examples) or even load the jQuery library in every page using the SmartTools.jQuery component. After that a function is attached to the jQuery document ready event. In this function the SOAP envelope message is constructed (the soapEnv variable). If you’d like to see the code getting list items from another list than the Task list, you’d have to change the listName element. The second part POST-ing the SOAP envelope to the web service by using jQuery’s ajax function. When the web service comes back with the result, the processResult method is called. In this function a loop is created over every row element (in the namespace z). Notice that "z:row" escapes in Javascript to "z\\:row". For every row element a new li HTML element is added to the ul element with ID tasksUL. And that’s it!
How to change the server name which has SharePoint 2007 installed?
Everyone is using and liking SharePoint these days because it is matching a lot of requirements we have. This is a cool and nice product released from Microsoft and we need to know about it and complete administration. I am working from long time on SharePoint and few months back i was trying to change the system name of the server in which SharePoint was installed, i learnt lot of things from it. But before discussing about it, i want to put something about what are the situations for renaming the server?
· We are developers and will work on ASP.NET, SharePoint, Silver light etc…. SharePoint itself is a very big system and if you install directly the product on the server means development environment then SharePoint installs some services. If you want to work on ASP.NET application tomorrow, then all SharePoint services will run by default. So whenever we don’t want SharePoint to be running on the server then we manually go to the services and stop them. Its not a good way of doing that. So, what i propose here is to create a VHD which has the SharePoint, Sql Server and related software needed for SharePoint. by providing some extra memory to your system i.e RAM around 2-3GB, it will run fast. When SharePoint is needed then only we will run the VHD otherwise not. So, in our office we have plenty of SharePoint developers and everyone will do the same creating VHD and install SharePoint. But it’s a very time consuming and long process. Installing will take plenty of time. So, we will create a single VHD and copy it on some share location. From there all devs, admin, team will get the VHD and work on it.
So, till now did you find any problems? no, it was a simple process. When will we get the problem? if we want to add the VHD to network. Now the problem starts…. We have a very big task that we need to add the server to domain and everyone will access the SharePoint server of each other. But we copied the VHD and installed on our system, so all VHD’s will have the same names. So we can’t add the servers to the domain because of having same names, network conflicts will come. So finally we need to performoperation to change the server name.
Steps:
Here we go: by following the steps below we can complete this operation.
· Changing the Alternate Access Mappings:
1. How to: Browse to SharePoint central administration, operations tab from the top navigation and under the section Global Configuration, select Alternate Access Mappings.
1. Click on the Alternate access mappings and here select the mapping collection to select all as shown in below figure.
1. Now, you can see all the mappings[urls] for the existing sites in SharePoint system. This is where we need to change the urls of the sites which points to the new urls. Click on the “Edit public urls” link on the top sub nav menu on the page. Here select the site from mapping collection on the right side one by one and map their urls to new server name as described below. For example, if your old server name is oldMOSSServer then the urls would be like this.
2. http://oldMOSSServer/, http://oldMOSSServer:8080/, http://oldMOSSServer:4534 etc…..
3. And if new server name is newMOSSServer then the url’s we need to changed to are as follows…
4. http://newMOSSServer/, http://newMOSSServer:8080/, http://newMOSSServer:4534 etc…..
Note: Don’t change any port numbers in the above operation, just change the server name only.
1. Repeat the above steps for all sites until everyone points to new server name.
· Rename the SharePoint server by using STSADM tool
1. Go to start –> run and type “cmd” to open the command prompt.
2. Move to the path where STSADM.exe file is resides. Usually it is in 12hive\Bin folder.
3. Command we need to run is renameserver. Syantax is:
stsadm -o renameserver -newservername "newservername" -oldservername "oldservername"
1. Change the strings highlighted in red to the new server name and old server name respectively and run the command. Remember by performing this operation means we changed the server name only within the SharePoint system but not on the server. This will only replaces the SharePoint system entries old server name with new name in SharePoint databases. Because in SharePoint everything will store in database.
· Rename the original system name
1. This is the simple operation generally all of us know. Go to Start button, right click on the Computer option and select Properties.
2. Click on the change button type the new name for the server and [add it to domain if it’s not already in] and save the changes.
3. RESTART your server.
· Change the System and SharePoint credentials
1. Change the credentials of the SharePoint server by running updatefarmcredentials command from STSADM tool.
2. Check once all IIS application pools points to the old system name, if any change them and restart IIS.
That’s it!!!
Do you think we are completed with the process? NO, last and final step, TESTING: please open the central admin site of the SharePoint and check everything is working fine!!!
Remember, if any thing is broken or not working as expected, then you are always welcome to revert back the changes you did. If central admin site is not opening then you can do the below steps to revert back to initial state.
1. Rename your server name and [remove from domain and add it to WorkGroup if it was not in the domain before].
2. Rename the SharePoint server by running STSADM command to old server name.
3. Change the Alternate access mappings to revert back to old server name.
4. Restart the server and check the changes.
5. Change the credentials, RESTART IIS.
6. You should be back with all settings as before.
Please post your comments here if you have any questions or issues.
Note: I was successfully performed all the steps as i said few months back, but forgot to change the Alternate access mappings. So what was the result, i always frustrated and felt bad that server change operation failed. After a long research and study we got it working. Hope this help others…
Tuesday, April 19, 2011
The Annoying “This Page has been modified since you opened it. You must open the page again” error message
<script language="”javascript”" type="”text/javascript”">
if(document.getElementById(“MSO_PageHashCode”))
{
document.getElementById(“MSO_PageHashCode”).value=”";
}
</script>
Sometimes , You may face this issue when using any button (like asp:linkbutton or asp:button) for navigating to different URL (i.e: using the postback property) because , it’ll submit page.form , So in order to avoid this you should use normal or use asp:hyperlink control.