Wednesday, June 30, 2010

How to configure Reporting Services 2008 in SharePoint 2010

Hi All,

In This post i will show how to configure SQL Reporting services in SharePoint 2010.

If you have a SharePoint 2010 site and you navigate to site settings and try to click on "Managed Services Schedule" you will get this error:
Unsupported Reporting Services Functionality

This is because your SharePoint configuration is not configured with Reporting services server.

- To fix that, follow below steps:
1) Login to the Reporting Services server and make sure that the service is up and running, and double check that the reporting server is working:
a) Open SQL Reporting configuration manager
b) Select Report Manager Url.
c) click on the url to make sure it is working.
For example: http://SERVERNAME/Reports/

2) Open SharePoint Central administration:
a) Select General Application Settings.
b) Select Reporting Services Integration.
c) Set the report server url.
d) Select authentication mode, Windows if the reports show personalized data.
OR select the trusted account that will be used for impersonation.
e) Click on Ok, You will get a successful page.
f) You might get the following error:
"Failed to establish connection with report server. Verify the server URL is correct or review ULS logs for more information. Product area: SQL Server Reporting Services, Category: Configuration Pages"

This means that the SSRS is not configured to run with SharePoint Integrated Mode, to change it,read below article "Overview of Configuration Steps on a Report Server":
http://technet.microsoft.com/en-us/library/bb326356.aspx


3) Go to your sharepoint site settings and enable Report Integration feature on site collection features.

4) Go to your site and add reporting services webpart in your page and configure it to your report.

Note: It is recommended to have a library that has all your reports in one place and all SQL Reporting services webparts are connecting to this library.

Happy SharePointing.... :)

Update [7/1/2010]: My friend @awsaxton On twitter- added this tip:
@MostafaElzoghbi On your SharePoint/RS blog, you may want to mention the need for SP1 CU7 to get RS 2008 to work with SP 2010.
Thanks Adam Saxton.

Regards,
Mostafa arafa

Thursday, June 17, 2010

BreakRoleInheritance Common mistake Tip for SharePoint Developers

Hi All,

This post is to share with SharePoint folks/Developers one of the common mistakes that i caught while debugging and reviewing one of my projects. They system is using Custom List to store Data. and we set the permissions in C#, Here is how to set the permissions on item level permissions in SharePoint 2007:

// Define Role Assignment object.
groupRoleAssignment = new SPRoleAssignment(SPContext.Current.Web.CurrentUser);

// Define the Permission Level you would like to give.
SPRoleDefinition readControlDef = SPContext.Current.Site.RootWeb.RoleDefinitions["Read"];

//Add Permissions to the Role
groupRoleAssignment.RoleDefinitionBindings.Add(readControlDef);

//Add the item to your custom list.
SPListItem myItem = web.Lists[RFIListName].Items.Add();

// Break the inheritance to add your custom - Note this step
myItem.BreakRoleInheritance(true);

// Add Role assignment to the created item.
myItem.RoleAssignments.Add(groupRoleAssignment);

myItem.Update();


To check the permissions on the item level in SharePoint 2007, here is the code you need to write:

SPListItem item = MyBLL.getListItem(Id);
// Check if the user has permissions to edit the item
if (!item.DoesUserHavePermissions(SPBasePermissions.EditListItems))
{// the user doesn't have permission to edit the item, do something...
}


The check above was returning True, even if the user doesn't have Edit/Contribute permissions on the item.

Why ?! If you check the above function on this line:
myItem.BreakRoleInheritance(true);

True: means copy the permissions first, then my code add more custom permissions. and this is not what i want, i don't want to inherit any permissions from the site.

False: Means don't copy and i will handle the permissions by my self. and this is what i want.

The Developer who wrote above lines didn't read the description of the function, he thought that he wants to break the permissions by setting it to true.

Lessons learned, and this is the point i want to share it with all.

Hope this helps.

Regards,
Mostafa arafa

Thursday, June 10, 2010

NOVA Code Camp 12 June @ Microsoft Reston Office

Hi Folks,

Next Event will be at Microsoft Reston,VA Office 12th June 2010, Organized and managed by Nova Code Camp Community.

Event will have the following topics: ASP.NET,C#,MVC,SharePoint,AZURE, Mobile Development,Silverlight and much more.

To check the schedule:
http://novacodecamp.org/RecentCodeCamps/NovaCodeCamp201001/Schedule/tabid/202/Default.aspx

Speakers List:
http://novacodecamp.org/RecentCodeCamps/NovaCodeCamp201001/Speakers/tabid/196/Default.aspx

I will be speaking in this event my session will be 2:45-4:00 PM and i will cover SharePoint 2010 Development and the following topics will be discussed:
1) VS 2010 Development tools for sharepoint developers.
2) Client Object Model vs. Server Object Model.
3) Sandbox solutions.
4) BCS in SharePoint 2010.

Have questions ? want to know more...come and attend my session.

Full day of technical topics on interesting top-notch technologies.

Follow Event updates: #NOVACC

Ref.:
http://novacodecamp.org/Home/tabid/36/Default.aspx

Wednesday, June 09, 2010

SharePoint 2010 development errors and fixes

Hi Folks,

I want to share 2 errors i was getting while working with the ECMA Javascript Client Object Model in SharePoint 2010.

Error #!: only content controls are allowed directly in a content page that contains content controls. script

Why : when you have script block outside the content controls in your application pages in sharepoint 2010.

Solution:
Add your Script block on the PlaceHolderAdditionalPageHead
In your application page.

Error #2: Cannot make a cache safe URL for "1033/sp.debug.js", file not found. Please verify that the file exists under the layouts directory.

Why this happen? Because SP.debug.js doesn't exist under layouts folder in sharepoint 2010.

Fix: Copy your SP.debug.js from this file path:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS

and paste it on the following directory:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033

Hope this helps.



Regards,
Mostafa arafa