Search This Blog

Saturday, October 2, 2010

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.

Sunday, June 20, 2010

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.

Saturday, August 1, 2009

SharePoint shows garbled / junk characters instead of Arabic Characters

While working with multilingual SharePoint site I came across a strange problem. The arabic characters or any non english characters which I entered in dataform webparts appeared as garbled. There were strange characters when viewing the page in browser but it looked absolutely fine in SharePoint designer.

We developers sometimes are careless about basic things which should be taken care of. What I did was just dragged the dataform webpart on the page without adding the web part zone on the page. I added the web part zone and moved the webpart in the zone. Bingo! things worked smoothly. The page worked like a breeze showing the arabic text.

I don't know why SharePoint did not recognize the Unicode characters (in my case arabic) directly on the page. Why it require the web part zone to function correctly? I am still searching for the reason.

Would love to hear from you people about this issue and what could be the exact reason behind the issue.