Thursday, September 25, 2008

Test Database Connectivity and DOS command to create file of any size

Here are the steps to test database/database server connectivity from any remote computer.

These steps assume that you have deployed small, medium or large SharePoint server farm and you have established Remote Desktop Connection to one of the Front End Web Servers or Application Servers using account which has full database access privileges and you want to test database connectivity.

For example, following screen shots were taken while testing database connectivity from Front End Web Server - "SPWeb"

1. Establish Remote Desktop Connection to "SPWeb" using "domain\SPAdmin" AD account.

Note: AD Account - "domain\SPAdmin" was used for installing MOSS 2007 and it was assigned DBCreator and SecurityAdmin server roles on SQL Server.

2. Create a new text document.

3. Rename and change the file extension of text document to .udl extension (e.g. DBTest.udl).

4. Double click on DBTest.udl. It will take you to "Connection" tab by default.

5. Select "Provider" tab on the top and choose "Microsoft OLE DB Provider for SQL Server" under "Select the data you want to connect to: " and OLE DB Provider(s) menu. Click "Next" button at the bottom.

6. When you hit next button on previous screen ("Provider" tab), it will bring you back to "Connection" tab.

Step 1: Enter the name of the database server to test the database connectivity (e.g. "Database Server")

Step 2: Select "Use Windows NT Integrated security" option. This is because you are testing database connectivity from "SPWeb" Front End Web Server and you are already logged into that server using AD account "domain\SPAdmin" which has full database access privileges.

Now, click "Refresh" button.

7. This will take few seconds (5-20 seconds) and it will load all the database names to pull down menu.

8. You may select one of the SharePoint databases (e.g. SharePoint_Config_DB) and hit "Test Connection" button at the bottom. It should popup window with "Test connection succeeded." message.

Conclusion: I wanted to test database connectivity from Front Web Server - "SPWeb". So I established Remote Desktop Connection to "SPWeb" using AD Account "domain\SPAdmin", which has full database access privileges on all the SharePoint databases. I used "DBTest.udl" file to test connectivity to "SharePoint_Config_DB" database (SharePoint Configuration database) on database server - "Database Server".

This may help verifying database connectivity and if this test fails, you need to troubleshoot database connectivity issues before you start looking in to the SharePoint errors/issues.

DOS command to create file of any size:

fsutil file createnew C:\Brij\One_MB_File.doc 1024000

Above command will create 1 MB file called "One_MB_File.doc" at C:\Brij location.

You can provide any file extension - e.g. .txt, .xls, .ppt, .pdf etc.

This command may help in creating files for upload/download test in SharePoint or any other application.

Thursday, September 18, 2008

Error when you assign workflow to a SharePoint group and its work around

I want to create a simple out of the box “Approval Workflow” and assign it to a SharePoint group. Let’s create approval workflow for “Project Document Library”,

Click “Workflow settings” under “Permissions and Management” menu of document library settings,

Select “Approval” for the workflow template,

I am assigning this workflow to “Workflow Approvers” SharePoint group. As we can see, “Assign a single task to each group entered(Do not expand groups)” checkbox is not selected by default. We will keep this default setting and see what happens,

Click “OK” and add this workflow. Once you add a new document to “Project Document Library” instead of starting workflow it will show you following error,

Also, it will show “Error Occurred” status for Approval Workflow as shown below,

So here is how you can fix this issue. You need to select “Assign a single task to each group entered(Do not expand groups)” checkbox when you assign it to a SharePoint group otherwise it will not start the workflow and result in error.

This will start the approval workflow and update its status accordingly. We can see “In Progress” status and “Approved” status, once the document is approved as shown below,

Tuesday, September 16, 2008

How to check out or check in multiple documents?

I uploaded multiple documents to “Shared Documents” library, which resulted in all the documents “Checked Out”.

Note: All the documents will be checked out when you upload them. This happens only when you have “Require documents to be checked out before they can be edited” is turned on in document library settings as shown below,

Now, I would like to “Check In” all the documents of “Shared Documents” library at the same time – All at once.

Go to Site Actions > Site Settings or Site Actions > Site Settings > Modify All Site Settings,

Click “Content and structure” under “Site Administration” category,

Click Actions > Check In

Enter appropriate Check In comments,

This will check in all the documents as shown below,

Thursday, September 11, 2008

Display concatenated columns in Calendar view and customize pages for adding or editing list items

In this post, I am going to talk about two things:

- How to display more than one columns in SharePoint Calendar view

- How to customize ASPX pages/forms used for adding, editing or displaying list items using SharePoint Designer

So let’s start with how to display concatenated columns in Calendar view. Here is the simple Calendar Month view,

First requirement is, I want to add an additional column for organizer of the event and display title and time instead of just title in Calendar month view. I am going to add “Organizer” column to Calendar by creating a new column and selecting “People or Group” in column type so that I can select organizer of an event from AD users. Also it is set to display name of a person in organizer column.

As shown below, I can select organizer from AD users now,

My second requirement is to display more than one column in Calendar month view. I want to display “Title” and “Time” instead of just “Title”. So create a new column for the Calendar and select “Calculated (calculation based on other columns)” for column type. Next step is to define formula for this column. I have used following formula,

=Title&" | "&TEXT ([Start Time],"HH:MM AM/PM") &"-"&TEXT ([End Time],"HH:MM AM/PM")

Which will convert start time and end time to “Hours: Minutes AM/PM” string and then append it to “Title” of the event.

Finally I need to change column to display in month view of Calendar to “TitleAndTime” as shown below,

That’s it! You are done. Now you can see “Title” and “Time” in month view of Calendar.

Now, let’s see how we can customize ASPX pages (forms) to add, edit or display list items. I will walk you through the steps for customizing “NewForm.aspx” for adding a new event to a Calendar. To start with let’s open that SharePoint site in SharePoint Designer 2007. Once the SharePoint site is opened in SharePoint Designer, Go to the “Lists” and expand “Calendar”, Right click on “NewForm.aspx” and select “New From Existing Page” as shown below,

I would recommend you to save this page with different name at the same location - “Lists > Calendar”. So that “NewForm.aspx” page will remain intact and you will have an option to switch it back to original page in case you mess up this form while customizing it. So I am going to store it as “NewForm2.aspx”

Now we can start customizing “NewForm.aspx” page. The requirement is to keep only Title, Location, Start Time, End Time and Organizer columns and delete the rest. Here are the steps,

Select “PlaceHolderMain (Custom)” and click “Default to Master’s Content”,

Select “Yes” on the confirmation window,

“NewForm2.aspx” will look like this after following above steps,

With “PlaceHolderMain (Custom)” selected, Select “Insert” menu on the top and select “SharePoint Controls > Custom List Form…” as shown below,

Select “Calendar” in list and “Event” in content type. Also, select “New item form (used to add new items to the list)” in type of form to create,

“NewForm2.aspx” form will look like this after following above steps,

Now, we want to select all unwanted columns from this page – “NewForm2.aspx”. Select rows for Description, All Day Event, Recurrence and Workspace fields; Right click it and select Delete > Delete Rows to delete all these rows,

Here is how “NewForm2.aspx” looks like after customizing it as per above requirements,

Finally we want to set this page – “NewForm2.aspx” as default form when somebody adds a new event item to the Calendar. In order to do that, Right click on “Calendar” and select “Properties”,

Select “Supporting Files” tab and change new item form to “NewForm2.aspx” page with the help of “Browse” button,

Save all your changes and you are done!

Go to the Calendar of a SharePoint site and click “New” button to add a new event. You will have “NewForm2.aspx” page opened for adding new items,

Similarly you can customize pages/forms used for editing or displaying list items.