URL access to SSRS with parameters

Passing a parameter to a SSRS report that is hosted in SharePoint 2010 can be done using the following URL (assuming that the report parameter is a string) :

http://bisite/_layouts/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/Reports/MyReport.rdl&rv:ParamMode=Hidden&rp:city=Perth

rv:RelativeReportUrl is path to the report
rv:ParamMode is the parameters panel setting
rp:city is the report’s parameter (Please note the prefix ‘rp‘)

For more information about other URL options, please refer to this link msdn

If the report is based on Analysis Service (SSAS), the parameter would be slightly different. Instead of just the value, the parameter needs to be in MDX format, e.g. [CityInfo].[City].&[Perth]

Using the example above, the URL to pass the SSAS parameter would be:

http://bisite/_layouts/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/Reports/MyReport.rdl&rv:ParamMode=Hidden&rp:city=%5BCityInfo%5D.%5BCity%5D.%26%5BPerth%5D

*Please note that the ampersand (&) should be replaced with %26

Using SharePoint PeopleEditor user control

I had the chance to play with PeopleEditor user control on my previous project and just thought would be good to put another blog about it out there, so here you go:

Started with creating a visual web part and the next step is adding the control to the ascx page

<SharePoint:PeopleEditor ID="peUser" ValidatorEnabled="true" runat="server"
                        SelectionSet="User" Width="350px" IsValid="true" AllowTypeIn="true"
                        MultiSelect="true"></SharePoint:PeopleEditor>
<SharePoint:InputFormRequiredFieldValidator ID="rfvUser" 
                        SetFocusOnError="true" runat="server" ControlToValidate="peUser" BreakBefore="true"
                        ErrorMessage="Required field." EnableClientScript="false"
                        Display="Dynamic"></SharePoint:InputFormRequiredFieldValidator>

To get the selected users we can iterate through its resovedEntities property

for (index = 0; index <= peControl.ResolvedEntities.Count - 1; ++index)
{
    PickerEntity entity = (PickerEntity)peopleEdControl.ResolvedEntities[index];
    SelectedUser selectedUser = new SelectedUser(){ Id = Convert.ToInt32(entity.EntityData["SPUserID"])
                                                    , Name = entity.DisplayText
                                                    , LoginName = entity.Key };
    selectedUserList.Add(selectedUser);
}

To assign a value to PeopleEditor user control (in my case I use a string of login name separated by a semicolon)

string[] delimiter = { ";" };
string[] loginNames = loginNameString.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);

foreach(string loginName in loginNames)
{
     PickerEntity pe = new PickerEntity();
     pe.Key = loginName;

     pe = peUser.ValidateEntity(pe);
     ArrayList entityList = new ArrayList() { pe };

     peUser.UpdateEntities(entityList);
}

Hope that helps 🙂

SharePoint URL Field

One way to assign value to URL field is by joining the url string and its description e.g. https://akurniaga.wordpress.com, My Blog (Not so nice but it works).

Another way is to use SPFieldURLValue:

To get value from a URL Field:

SPFieldUrlValue urlField = new SPFieldUrlValue(item["MyUrl"].ToString());
string description = urlField.Description;
string url = urlField.Url;

To assign to a URL Field:

SPFieldUrlValue urlField = new SPFieldUrlValue();
urlField.Url = "https://akurniaga.wordpress.com";
urlField.Description = "My Blog";
item["MyUrl"] = urlField;

Simple right? 🙂

A quick and easy way to read RSS in SharePoint Foundation 2010

Thanks to George Tsiokos for his Data view web part http://sharepointrss.com/, we just have to submit the form on the site. This will produce a .DWP file. Save the .DWP file to your local drive and the next step is to upload this .DWP file to a web part page in SharePoint and you can view the RSS feed. No installation required 🙂

Super user for SharePoint Web Application

I found the following warning message in EventViewer :

“Object Cache: The super user account utilized by the cache is not configured. This can increase the number of cache misses, which causes the page requests to consume unneccesary system resources.”

Resolved it by creating 2 user policies for the web application, 1 for super user and 1 for super reader. These users should not be farm administrators nor Application pool accounts.

Steps:
1. Go to Central Administration
2. Click the Application Management
3. Click the Manage web applications
4. Click the Web application and select User Policy from the Policy ribbon bar
5. Click Add Users
6. Select All Zones and click the Next button
7. Type domain\spSuperUser and give the user Full Control permission
8. Click Finish
9. Repeat Step 4 -8 for domain\spSuperReader

After adding the user policies, run the following PowerShell script:

$webApp = Get-SPWebApplication "http://url/&quot;
$webApp.Properties["portalsuperuseraccount"] = "domain\spsuperuser"
$webApp.Properties["portalsuperreaderaccount"] = "domain\spsuperreader"
$webApp.Update()

Please note if you use Claim based authentication the username format will be different.

Hope that helps

Show subsite on top navigation

Showing subsite programmatically is not as straight forward as using the UI

Global navigation

I found out that this property is only available from PublishingWeb (instead of SPWeb object) which is contained in Microsoft.Sharepoint.Publishing.dll. By default VS 2010 does not include the dll in the reference. After adding the dll, use the code below to show sub sites

PublishingWeb publisher = PublishingWeb.GetPublishingWeb(myWeb);
                        
publisher.Navigation.GlobalIncludeSubSites = true;
publisher.Update();
publisher.Close();

            

Hope that helps

Exception from HRESULT: 0x8107026E0

I got that exeception when I tried to deploy my solution. The problem was because I renamed my web template but I didn’t change the name attribute of the web template itself.

Hope that can help 🙂

Sharepoint list type id

Something that I always forget. You can also find it in http://msdn.microsoft.com/en-us/library/ms439434.aspx

100 Generic list

101 Document library

102 Survey

103 Links list

104 Announcements list

105 Contacts list

106 Events list

107 Tasks list

108 Discussion board

109 Picture library

110 Data sources

111 Site template gallery

112 User Information list

113 Web Part gallery

114 List template gallery

115 XML Form library

116 Master pages gallery

117 No-Code Workflows

118 Custom Workflow Process

119 Wiki Page library

120 Custom grid for a list

130 Data Connection library

140 Workflow History

150 Gantt Tasks list

200 Meeting Series list

201 Meeting Agenda list

202 Meeting Attendees list

204 Meeting Decisions list

207 Meeting Objectives list

210 Meeting text box

211 Meeting Things To Bring list

212 Meeting Workspace Pages list

301 Blog Posts list

302 Blog Comments list

303 Blog Categories list

1100 Issue tracking

1200 Administrator tasks list