Archive for November, 2009


Suppose you use Microsoft Office SharePoint Designer to customize the NewForm.aspx page of a list in SharePoint, you connect to the list by using a Web browser.You may face any of the following issues.

  1. You click New to create a new item in the list. In this scenario, you may get the following error message “Invalid page URL:” a small JavaScript pop up window that appears on the screen.
  2. You get this error message “An unexpected error has occurred” when you click an existing item in the list.
  3. Additionally, you might view the properties of the list in SharePoint Designer 2007 and then specify the NewForm.aspx page in the New item form box. When you do this, the NewForm.aspx page appears to be saved as the new item form when you click OK. However, the next time that you view the properties of the list, the New item form box is empty.

Reason for the issue : This issue occurs if you deleted the List Form Web Part from the NewForm.aspx page.

Solution : To resolve this issue, delete the list, and then re-create it. Then, customize the NewForm.aspx page. When you customize the NewForm.aspx page, make sure that you do not delete the List Form Web Part.

If you want to customize the controls that appear on the NewForm.aspx page, and if you do not want to show the default List Form Web Part, you can hide the List Form Web Part. To do this, follow these steps:

  1. Start SharePoint Designer 2007, and then open the NewForm.aspx page for the list.
  2. Right-click the List Form Web Part, and then click Web Part Properties.
  3. Expand Layout, click to select the Hidden check box, and then click OK.
Advertisements

We normally use SharePoint Designer to edit the default forms of a list and add a Custom List form web part in the SharePoint site. This will work fine. But when we try to add an attachment, by clicking Attach File in the custom form you will receive this error message “This form was customized not working with attachment“..

I found out that Microsoft has released hot-fix 953749 to address this issue along with a recommended resolution for fixing the XSL to allow attachments to work again. You can get the details here. The resolution details how to address all form types (new, edit and display). There is even a recommended fix for the error “An unexpected error has occurred.”


Relpacing the default forms (NewForm, EditForm, DispForm) of a SharePoint list is essential when ever you want the form to be customized using ASP.net to provide additional functionality. So how to do it. Its simple with the use of SharePoint Designer. Follow these simple steps.

  1. Open the site in the SharePoint designer.
  2. In the lists folder navigate to the list you want to add the custom form.
  3. Copy the form(NewForm/EditForm/DispForm) and paste it in the same folder.
  4. Rename it to something like CustForm.aspx.
  5. Now open the file, in the default  DataView Webpart find this tags <IsVisible>true</IsVisible>
  6. Make the value to false which will hide that webpart.
  7. Now add a Custom List  Form or a webpart that you need in the page.
  8. Now we have to replace this custom page as our list’s default page.
  9. In the Folder List navigation panel, right click the list and go to Properties.
  10. In Supporting Files tab in Content type specific forms drop down select the appropriate content type for your list.
  11. And here you can change the default form by browsing to the custom  form we have created.

This seems involving little more steps than like creating a webpart page and deploying a webpart instead. But the advantage is that the query string values which we get in the default forms (NewForm/EditForm/DispForm) will available in this form also. Also the behaviour of the list where the edit item, display item and new item links in the list work as it is.

Sharepoint 2010 is no more MOSS

Posted: November 25, 2009 in Sharepoint 2010

You could have noticed that Sharepoint 2010 is Microsoft SharePoint Server 2010 and not MOSS 2010.

What happened to the Office piece of the name? We love MOSS. . . .

The first thing you’ll notice is that the MOSS acronym goes away with the new name since Office is no longer in the SharePoint official name. No one should worry that SharePoint doesn’t work great with Office 2010 since Office is removed from the name, just like people didn’t worry whether SharePoint was a great portal product when Portal was removed from the 2007 name.

The primary reason why Office was removed out of the name is : lots of folks associate the name Office with the Office client. Microsoft wanted to reestablish the Office name and brand to be synonymous with the client suite.

Don’t try to acronym Microsoft SharePoint Server to MSS since MSS is already taken by Microsoft Search Server. Just remember, SharePoint is SharePoint is SharePoint..

More details here http://blogs.msdn.com/sharepoint


As a SharePoint developer or an administrator first thing that comes into our mind when we think of getting the list of site collection and subsites will be using stsadm command line utility.  You can use the command

stsadm.exe -o enumsites -url <root url>

to get the list  of site collections and

stsadm.exe -o enumsubwebs -url <root url>

to get the list of sub sites.

It will be great if we combine both of these. Here is the VB script code to  do this which will create an XML file that you can open in an excel file.

Option Explicit
Const STSADM_PATH =”C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm”
Const ROOT_URL = “
http://root/
Const FILE_NAME = “G:\listofsites.xml”
 
Dim objShell, objExec, objXml, objXml2,objXml3, objSc,objFso, objFile, objWeb
Dim strResult, strSubResult, strUrl, strCmd, strOwner, strXML, returnValue, returnValue1 
 
‘Retrieves all site collections in XML format.
 
WScript.Echo “Creating shell object and calling root enumsites command”
 
Set objShell = CreateObject(“WScript.Shell”)
Set objExec = objShell.Exec(STSADM_PATH & ” -o enumsites -url ” & ROOT_URL)
 
strResult = objExec.StdOut.ReadAll
 
 
‘Load XML in DOM document so it can be processed.
 
WScript.Echo “Loading XML File”
Set objXml = CreateObject(“MSXML2.DOMDocument”)
Set objXml2 = CreateObject(“MSXML2.DOMDocument”)
Set objXml3 = CreateObject(“MSXML2.DOMDocument”)

objXml.async=false
objXml.LoadXML(strResult)
 
WScript.Echo “Creating File System Object”
‘Create the FileSystemObject and write to file.
Set objFso = CreateObject(“Scripting.FileSystemObject”)
 
if objFso.FileExists(FILE_NAME) then
    objFso.DeleteFile FILE_NAME, True
end if
 
set objFile = objFso.CreateTextFile(FILE_NAME, True)
 
‘Loop through each site collection and call enumsubwebs to get the child URL’s.
 
objFile.WriteLine(“<ROOT>”)
For Each objSc in objXml.DocumentElement.ChildNodes
    strUrl = objSc.Attributes.GetNamedItem(“Url”).Text
    strOwner = objSc.Attributes.GetNamedItem(“Owner”).Text
    strCmd = STSADM_PATH & ” -o enumsubwebs -url “”” + strUrl + “”””
 
    Set objExec = objShell.Exec(strCmd)
    strResult = objExec.StdOut.ReadAll
   
    objFile.WriteLine(“<SITECOLLECTION SiteCollectionURL='” & strUrl & “‘ Owner = ‘” & strOwner & “‘>”)
    objFile.WriteLine(strResult)
    WScript.Echo “Traversing the sub Webs…”
    call GetSubSites(strResult)
    objFile.WriteLine(“</SITECOLLECTION>”)
  
Next
objFile.WriteLine(“</ROOT>”)
 
set objFile = nothing
set objFso = nothing
set objXml = nothing
set objXml2 = nothing
set objXml3 = nothing
set objExec = nothing
 
WScript.Echo “File created”
 
sub GetSubSites(strResult)
objXml.async=false
returnValue1 = objXml2.LoadXML(strResult)
if returnValue1 = true then
for Each objWeb in objXml2.DocumentElement.ChildNodes
    strCmd = STSADM_PATH & ” -o enumsubwebs -url “”” + objWeb.text + “”””
    Set objExec = objShell.Exec(strCmd)
    strResult = objExec.StdOut.ReadAll
 
    objXml.async=false
    returnValue = objXml3.LoadXML(strResult)
    if returnValue = true then
 if objXml3.DocumentElement.Attributes.GetNamedItem(“Count”).Text <> “0” Then
 objFile.WriteLine(strResult)
 WScript.Echo strResult
 call GetSubSites(strResult)
 end if
    end if

next
end if
end sub

 

ROOT_URL  will be your farm’s root URL.

FILE_NAME will be the path for output XML .

STSADM_PATH will be the path where yout stsadm.exe resides.

After creating the script file run it in command prompt using the command

cscript.exe ListAllMossSites.vbs

This will create a XML file. Open this in an excel. You will have all the details.