Monday, May 19, 2008
the following snippet get the current user lgged into Sharepoint and displays his/her Name, Login name, Email and all the groups he/she belongs to.
try {SPWeb web = SPControl.GetContextWeb(Context);SPUser sUser = web.CurrentUser; string str = "Name:" + sUser.Name + "<BR>"; "Login Name :" + sUser.LoginName + "<BR>"; "Email:" + sUser.Email + "<BR>"; "Groups:" + sUser.Groups.Count + "<BR>"; foreach (SPGroup grp in sUser.Groups) { " * " + grp.Name + " total Members:" + grp.Users.Count + "<BR>"; catch (Exception ex) { "No Current User" ;
str +=
str +=
str +=
str +=
}
lblInfo.Text = str;
}
lblInfo.Text=
}
Monday, April 28, 2008
In almost every Reporting Services class I teach, I get basically same questions. One of the most popular questions is how do I call a method in a custom assembly from my report. Here are step By step, instructions to do this.
1. Using Visual Studio Create a new Class Library(VB or C#) I am going to name my Project SSRSAssembly
2. Rename your Class1.VB or Class1.CS to ComplexCalculations, presumably you would have your re-usable methods in this class
3. For next step, please use your imagination, pretend the following function has a few lines of code with loops possible calls to other assemblies and does some complex calculations (instead of just returning the square value of the parameter being sent to it.
(a) Add the following Method to your Class
VB
Public Function SquareMe(ByVal i As Integer) As Integer
Return i ^ 2
End Function
C#
public int SquareMe(int i)
{
return Math.Pow(i, 2);
}
4. Build Your project .
5. Open your Report project.
(1) Access your report properties from the Reports menu option
(2) Click on the reference tab and add a reference to your assembly by browsing to it.
(3) Define the class name ( in my example I called my class ComplexCalculations)
(4) Provide an Instance name.
6. In a textbox within your dataregion where you want to display the result of your call, enter:
=Code.MyInstance.SquareMe(Fields!SickLeaveHours.Value)
7. Copy your Custom dll to Report Server bin folder (default location is C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin)
8. Open rssvPolicy.config located in C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin.
9. After the last <CodeGroup .. add
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="SSRSAssembly" Description="reportHelperLib. ">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\SSRSAssembly.dll"
/>
</CodeGroup>
10. Note you might have to change the Name and the URL.
Thursday, January 24, 2008
The Code Camp will be held on Saturday 2/2/2008 and include breakfast, lunch, giveaways, valuable raffle items and of course lots of great content!
The sessions are now listed on the agenda page. A big thanks to all the speakers that have stepped forward and volunteered to come speak at their own expense. We have already scheduled 70 of 72 sessions. There will be something for everyone... from the person who is new to .net to advanced architecture and software process sessions. For the second year we will have an all Spanish track. Dedicated tracks include "Into to .NET", "Silverlight" and "Agile / CI". Sessions include Ajax, MVC, Visual Studio 2008, Powershell, Windows Workflow and .NET reflection.
Over 500 attendees have signed up, and we should easily bypass last years number, if yo uhave not signed up please do so http://www.clicktoattend.com/?id=122048
Find more information at http://codecamp08.fladotnet.com .
Friday, December 07, 2007
There are only 50 copies available but we will have other activites so please stop by!
I've put up a list of the 1st 100 to register at: http://www.fladotnet.com/vs2k8.aspx.
There are only 50 copies but i'm sure that not all of the 1st 50 will show up on time with a computer to do the installation.
Speaker registration form at: http://codecamp08.fladotnet.com.
We have been receiving speaker proposals, should have enough rooms to accomodate anyone who wishes to speak and will get the sessions posted on the website soon.
The tracks (subject to change) are:
|
- Intro to .NET
|
|
- Web Development
|
|
- Windows / Smart Client
|
|
- SQL / Data / BI
|
|
- .NET New and Cool
|
|
- Agile / CI
|
|
- Architecture
|
|
- Frameworks
|
|
- Office Development
|
|
- Gaming
|
|
- SharePoint
|
|
- Spanish
|
To attend this outstanding free event, register at: http://www.clicktoattend.com/?id=122048
Thursday, June 21, 2007
This example uses adventure works sample database and reports, please refer to books on line for setup instructions.
1. Open Visual Studio and create a console application (VB or C#)
2. Replace the code in Module.vb or Module.cs with the appropriate code snippet
a. C#
using System;
using SoapAPI.ReportService2005;
class Module1
{
public void Main()
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = "http://Localhost/reportserver/reportservice2005.asmx";
Property name = new Property();
name.Name = "Name";
Property description = new Property();
description.Name = "Description";
Property[] properties = new Property[2];
properties(0) = name;
properties(1) = description;
try {
Property[] returnProperties = rs.GetProperties("/AdventureWorks Sample Reports/Company Sales", properties);
Property p;
foreach ( p in returnProperties) {
Console.WriteLine((p.Name + ": " + p.Value));
}
}
catch (Exception e) {
Console.WriteLine(e.Message);
}
finally {
Console.ReadLine();
}
}
}
b. VB
Imports System
Imports SoapAPI.ReportService2005
Module Module1
Sub Main()
Dim rs As New ReportingService2005
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.Url = "http://Localhost/reportserver/reportservice2005.asmx"
Dim name As New [Property]
name.Name = "Name"
Dim description As New [Property]
description.Name = "Description"
Dim properties(1) As [Property]
properties(0) = name
properties(1) = description
Try
Dim returnProperties As [Property]() = rs.GetProperties("/AdventureWorks Sample Reports/Company Sales", properties)
Dim p As [Property]
For Each p In returnProperties
Console.WriteLine((p.Name + ": " + p.Value))
Next p
Catch e As Exception
Console.WriteLine(e.Message)
Finally
Console.ReadLine()
End Try
End Sub
End Module
3. Run the application
Wednesday, June 20, 2007
This example uses adventure works sample database and reports, please refer to books on line for setup instructions.
1. Open Visual Studio and create a console application (VB or C#)
2. Replace the code in Module.vb or Module.cs with the appropriate code snippet
a. C#
using System;
using SoapAPI.ReportService2005;
class Module1
{
public void Main()
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = "http://Localhost/reportserver/reportservice2005.asmx";
Property name = new Property();
name.Name = "Name";
Property description = new Property();
description.Name = "Description";
Property[] properties = new Property[2];
properties(0) = name;
properties(1) = description;
try {
Property[] returnProperties = rs.GetProperties("/AdventureWorks Sample Reports/Company Sales", properties);
Property p;
foreach ( p in returnProperties) {
Console.WriteLine((p.Name + ": " + p.Value));
}
}
catch (Exception e) {
Console.WriteLine(e.Message);
}
finally {
Console.ReadLine();
}
}
}
b. VB
Imports System
Imports SoapAPI.ReportService2005
Module Module1
Sub Main()
Dim rs As New ReportingService2005
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.Url = "http://Localhost/reportserver/reportservice2005.asmx"
Dim name As New [Property]
name.Name = "Name"
Dim description As New [Property]
description.Name = "Description"
Dim properties(1) As [Property]
properties(0) = name
properties(1) = description
Try
Dim returnProperties As [Property]() = rs.GetProperties("/AdventureWorks Sample Reports/Company Sales", properties)
Dim p As [Property]
For Each p In returnProperties
Console.WriteLine((p.Name + ": " + p.Value))
Next p
Catch e As Exception
Console.WriteLine(e.Message)
Finally
Console.ReadLine()
End Try
End Sub
End Module
3. Run the application
One of my custmers wanted to use their own scheduler control all of their SSRS subscriptions. if you need to do the same here is the step by step example of acomplishing this task.
Create either a datadriven or regular subscription
1. In Management studio connect to the Database Engine (local)
2. Expand the database and drill down to Report Server Database
3. Click on File à New à query with current connection
4. In the query window type the following command and execute it to get the subscription ID
Select * <