Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Archive for March, 2013

Knowledge Sheet – Configuration Database Permission Solution

Posted by Paul on March 15, 2013

Error – This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.
Scenario: In C# invoked the SPWebApplication.Lookup() method.
 
Solution 1: Add the current user to the SQL Server > Security folder.
image

Solution 2: Run the application in the context of Privileged user who has above access.

Use Command Prompt to execute the command:

runas /user:DOMAINUSERNAME “YourApplicationPath”

clip_image001[4]

 Reference: http://technet.microsoft.com/en-us/library/cc771525(v=ws.10).aspx

Advertisements

Posted in C#, SharePoint | Tagged: , | Leave a Comment »

Knowledge Sheet – Configuration Database Permission Solution

Posted by Paul on March 15, 2013

Error – This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.
Scenario: In C# invoked the SPWebApplication.Lookup() method.
 
Solution 1: Add the current user to the SQL Server > Security folder.
image

Solution 2: Run the application in the context of Privileged user who has above access.

Use Command Prompt to execute the command:

runas /user:DOMAIN\USERNAME “YourApplicationPath”

clip_image001[4]

 Reference: http://technet.microsoft.com/en-us/library/cc771525(v=ws.10).aspx

Posted in C# | Leave a Comment »

Privacy on List Items – Out-of-the-box support

Posted by Paul on March 8, 2013

In this article I would like to use a SharePoint Out of the Box Solution for a common problem. The problem is associated with a survey list where:

1. Items can be created by any user

2. But editing / deleting should be possible by the item created user

Example: A survey list for employee feedback

What is Out of the Box?

This is a term used to denote in-built features of SharePoint. Out-of-the-box solutions are preferred & encouraged as it is easier to perform in the short run & easier to manage in the long.

Possible Solutions

We can quickly jump into solutions like creating an Event Handler and on the Item Updated event we can ensure the user & cancel the event. But the drawback is that it requires code development, installation & maintenance.

Instead we can go for the Out-of-the-box solution – Modifying List Advanced Settings.

Create the List

To execute this please perform the following activities:

1. Create a List named My List from template Contacts.

2. Create a user named user1 and add to List Permissions, assign Contribute level

3. Create a user named user2 and add to List Permissions, assign Contribute level

4. Login as user1 and create a contact named User 1 Contact

5. Login as user12 and create a contact named User 2 Contact

clip_image002

Now the list looks like below:

clip_image004

clip_image006

Please use separate browsers with different session instance for users: Administrator, User1 & User2

Modify Advanced Settings

Now we can modify the List Advanced Settings. Open the list in Administrator mode & choose List Settings > Advanced Settings.

clip_image007

From the appearing page select the following options.

clip_image009

Click the OK button to save changes. Now you can see that:

User 1 can only view his own item:

clip_image011

User 2 can only view his own item:

clip_image013

Administrator can view both items:

clip_image015

clip_image006[1]

Please note that the Permission Levels determine the visibility.

1. Administrator is given Full Control permission level

2. User 1, User 2 are given Contribute permission level

References

http://bit.ly/10uiVpB

Summary

In this article we have seen a possible scenario of List Item Permissions. SharePoint consists of various options & out-of-the-box solutions we need to be aware with.

This solution is apt for Survey Scenarios, where multiple users are required to provide their feedback, but they should not see other’s feedbacks.

Please note that SharePoint 2010 also have a Survey list template.

Posted in C#, SharePoint | Tagged: , | Leave a Comment »

Content Editor Web Part & CSS Tricks

Posted by Paul on March 8, 2013

In this article I would like to inform you on the usage of Content Editor Web Part for CSS style manipulations.

What is Content Editor Web Part?

Content Editor Web Part is used to provide Formatted HTML Content to your web page. You can add a content editor web part following the steps below:

· Open the Page

· Choose Site Actions > Edit Page

· Click on Add Web Part

· Choose Content > Content Editor Web Part

· Save changes

clip_image002

You need to have Designer permission level to edit pages. Please make sure you consult your Governance Committee before making changes.

Why we need CSS style changes?

Your customer might require changes in the layout of SharePoint pages. Editing the master page would be a choice but it is much more costly in terms of effort & performance.

The customization requirements will be as:

1. Hiding the Quick Launch from the left side

2. Highlighting the Page Elements

3. Modifying the Calendar items display format

4. Modifying other common style elements

Little about CSS

Cascading Style Sheets allows us to modify the Look & Feel of HTML elements as a whole. For modifying a single element we can use the id property of the element.

For modifying items as a whole, we can use the class property of the element.


Hiding Quick Launch

In this example we can try hiding the Quick Launch from a page. Following are the steps involved:

1. Find the Quick Launch bar Division Id

2. Add code to hide the Division in Content Web Part

3. Hide the Content Web Part too

To start with open your site which is Okay to be played with:

clip_image004

Now you can see the Quick Launch in the above page. We need to find the Division Element Id of the Quick Launch Bar. For this click on F12 button or open Developer Tools from Internet Explorer. Move the cursor over the Quick Launch bar & click on it. You will get the class name highlighted as shown below:

clip_image005

We are taking the CSS class name highlighted in Green Color. Now edit the Content Editor Web Part and choose the HTML source from toolbar. clip_image007

Add the following code in the HTML Source:

<style>

. s4-notdlg

{

display: none;

}

</ style >

Please note that the above code hides the Quick Launch Bar by hiding the Division Class. Now save the changes to page & you can see the Quick Launch is hidden.

But Wait! The solution is not complete. You can see that there is space filled in the old quick launch position. We can remove that by using the margin-left property of division.

clip_image008

As the last step we needed to hide the Content Editor Web Part as well. Choose edit web part and choose the Hidden option from Layout category.

clip_image010

Click the OK button & now you can see that the Quick Launch is hidden.

Ghosting & Unghosting

Ghosting is the state on which pages are rendered from File System. Unghosting is the stage where the edited pages are residing in database and rendered from there.

Unghosted pages should reduce performance, but in negligible based on network traffic.

clip_image012


References

http://tinyurl.com/sp2010-contwp

http://tinyurl.com/sp2010-css

Summary

In this article we have explored Content Editor Web Part and CSS style manipulations. To summarize with following are the points worth keeping in mind.

1. Content Editor Web Part allows us to include HTML, CSS, Java Script

2. We can add CSS code to modify page elements

3. Content editor web part can be made hidden

4. Customizing Pages involve slight performance overheads

5. Unghosting occurs while editing pages

6. Get approval from SharePoint Governance committee before applying page modifications

Posted in C#, SharePoint | Tagged: , | Leave a Comment »