Search This Blog

Friday, October 15, 2010

SharePoint 2010 Resource Guide

Here is the link to complete SharePoint 2010 Resource guide compiled in a single location.

Enjoy SharePointing!

Thursday, October 14, 2010

Moving the Content DB to new Server

On very rare occasion we may need to change the server in which the content database is located. SharePoint provide a very simple solution to facilitate this requirement.

Word of Warning!
Before getting your hands dirty be sure that you have backed up entire farm or have appropriate disaster management plan in case of any catastrophe.
  • Open Central Administration and navigate to the application management tab.
  • Under SharePoint Web Application Management Section click on the Content Databases.
  • Verify you have selected the correct Web Application from the Menu.
  • Click on the database to be relocated.
  • Select the checkbox labelled "Remove Content Database" -> Accept the confirmation and press OK.
  • Now the selected database is removed from the list of the database .
  • Open SQL Server Management Studio and connect to the current database server.
  • Select the database -> Task -> Click Detach.
  • Select the Drop connection check box and press OK.
  • Now copy the MDF and LDF file from the current location and paste it to the new server.
  • Open SQL Server Management Studio and connect to the new database server and attach this database
  • Make sure that the SharePoint database access account is given appropriate access to the new database.
  • Now again Open Central Administration -> Application Management -> Content Database -> Select correct web application.
  • Click "Add a content database" link.
  • Enter new database server name
  • Enter moved database name
  • Select appropriate authentication mechanism
  • Select Search Server and press OK
Verify the availability of your database in the database list and also verify whether your site is working as required.

Saturday, October 2, 2010

Learn how to make web apps more secure


Learn how to make web apps more
secure. Do the Gruyere codelab.

Deny User's access to the entire portal / Web Application

We may have a requirement to block a specific user from entire SharePoint portal. How could we achieve this? What possible solution do we have?

One of the possible solutions is to remove the user from each and every group he is member of. Also remove any direct permission given to him in any of the sub site. But this would be very tedious task if there is large number of sub sites.

Even if we manage to do the task of manually going around in each and every site, there is a catch. What if one of the groups takes all member of the domain as it member? Yes this can happen. At the time of adding users to the group there is option to add all authenticated user to the group. To be specific we will have to add "NT AUTHORITY\authenticated users" to add all users to the group.

In such a scenario, even if we remove the permission of the user from each sub site, even if we remove the user from all groups. Still the user will have access to the portal due to the above action taken in the last paragraph.

Now what?

Don't Panic! There is simple and quick solution to the problem.

  1. Open up your Central Administration
  2. Navigate to the Application Management Tab
  3. Under Application Security Section click on the "Policy for web application link"
  4. Select appropriate Web Application to which user access should be denied.
  5. Click Add Users
  6. Select appropriate zone (Default is "All Zone") from which the user should be removed. Click Next.
  7. Now in the people picker add the user(s) you may want to deny access.
  8. Under Permission section, click on "Deny All"
  9. Press Finish.

That's all folks. Now let the user access the portal. He will be greeted with a sweet message "Access Denied".

Thursday, August 19, 2010

Deleting Individual events from a recurring series

In order to delete an individual event from a recurring series, you actually need to create a new event and set a few properties on it to link it up to a specific instance from the 'owning' series. You will need to set the following properties (You need all of them!):
  • MasterSeriesItemID
    • Set this to the ID of the owning calendar list item
  • UID
    • Set this to the UID of the ownding calendar list item. If you haven't populated this column in your owning list item, you'll be having all sorts of problems already...
  • EventType
    • Set this to 3 to mark it as a deleted record
  • fRecurrence
    • Set this to 1
  • fAllDayEvent
    • Set this to the fAllDayEvent property of the owner calendar list item
  • EventDate
    • Set this to the date of the event instance you want to delete
  • EndDate
    • Set this to the date of the event instance you want to delete
  • RecurrenceID
    • Set this to the date of the event instance you want to delete. (Yep, this is the one that caught me out...has to be set to a datetime and NOT an ID)
  • Title
    • Set this to the title of the owner calendar event, but prefixed with Deleted:
When you have done this, you should now see an additional event in the All Events view of the calendar with a title of "Deleted: Name of your event" and the date of the specific instance. In the Calendar view, the specific instance should be invisible. This means that if you want to undo your deleted instance, you simply delete the extra list item that you have created and it will reappear!

The above extract is taken from Justin French's Blog. Justin's post talks more about working with SharePoint's Recurring Events. Do check it out.

Wednesday, June 16, 2010

STSADM Error: "Object reference not set to an instance of an object"

I wanted to deploy the newly created site definition build into a wsp package on my clients machine. The solution worked fine on my machine. But when I tried to add the solution to my clients server using the command stsadm -o addsolution -filename "<solution name.wsp>" I got an error "Object reference not set to an instance of an object".

I searched the SharePoint log at the location c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS for any additional information.

Following information was logged into the log file related to the issue:

06/15/2010 08:03:11.67     STSADM.EXE (0x1818)                         0x17E4    Windows SharePoint Services       Database                          880i    High        System.Data.SqlClient.SqlException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)     at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)     at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)     at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObje...   

On reviewing this info I found that I was using the local system admin account to deploy the feature. Only thing I did to resolve the issue was to re-login as domain account having appropriate access and deploy the solution.

Saturday, April 3, 2010

Created and Modified Field went missing

I was working on moving documents between document library. I used SharePoint's "Mange Content and Structure" to do the migration. The migration was successful and everything looked fine.

We had created a custom WebPart functionality  to fetch documents based on various metadata. It was also dependent on "Created" date. I found this broken after the move. The error was "Created Field not found" but it was visible in the document library. Only thing was during the API call to SharePoint from our custom code, the created field and its value was not being returned to our code and neither the field was being fetched using the tool "U2U CAML builder".

I found the day saver solution on Microsoft Technet. I just had to open the following page and press OK button.

http://[SiteURL]/_layouts/fldedit.aspx?field=Created.

Bingo! Everything seemed to work as before. The modified fields was also missing. I did the same for modified field. Now the Created and Modified field were also being returned in the datatable of the List Items.