My team and I, we're trying to create a subscription and export a report in CSV format, but we need to change the field delimiter from "," (which is the default). How can we pass the device information to a SSRS (2008) subscription programmatically (C#)?
We have a web reference to ReportingServices2005. This is and example of our code:
string report = "Insert report here";
string desc = "A description";
string eventType = "TimedSubscription";
string matchData = "<ScheduleDefinition>...</ScheduleDefinition>";
string RenderFormat = "CSV";
ParameterValue[] reportParameters = GetReportParameters();
var extensionParams = new List<ParameterValue>();
extensionParams.Add(new ParameterValue
{
Name = Constants.EXTENSIONPARAMRENDER_FORMAT,
Value = RenderFormat
});
extensionParams.Add(new ParameterValue
{
Name = Constants.EXTENSIONPARAMFILENAME,
Value = FileName
});
// Insert more params here...
ExtensionSettings extSettings = new ExtensionSettings();
extSettings.ParameterValues = extensionParams.ToArray();
extSettings.Extension = Constants.EXTENSIONREPORTSERVERFILESHARE;
try
{
ReportingService2005 rs = new ReportingService2005();
rs.CreateSubscription(
report, extSettings, desc, eventType, matchData, reportParameters);
}
catch (SoapException e)
{
// Handle the exception
}
We can't find a way to pass the device information, is this even posible?
For more info check:
http://msdn.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.reportingservice2005.createsubscription%28v=SQL.90%29.aspx
You can't pass DeviceInfo to the CreateSubscription() method, but one of these two approaches may do the trick for you...
See Customizing Rendering Extension Parameters in RSReportServer.Config to create a new version of the default "CSV" extension where you can configure the DeviceInfo you require. So you could add a section like this in your config file...
<Extension Name="CsvPipeDelimited" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
<Configuration>
<DeviceInfo>
<Extension>txt</Extension>
<FieldDelimiter>|</FieldDelimiter>
<NoHeader>false</NoHeader>
</DeviceInfo>
</Configuration>
</Extension>
Implementing a Rendering Extension is much more involved, but gives you more control.
Once you have your new Rendering Extension, you can pass the name like this...
extensionParams.Add(new ParameterValue
{
Name = "RenderFormat",
Value = "CsvPipeDelimited"
});
Related
I need to create an interface from a Hotel PMS application to a Broadworks PBX using OCI. I am on the hotel PMS side. I have located broadworks-connector-net
1: https://github.com/cwmiller/broadworks-connector-net and I am trying to work my way in
The objective is whenever a room is checked in in the PMS application, to get the extension and instruct the PBX to open the line and assign the name of guest in it (so the receptionist can see who is calling from each room).
I have found no API manual and the Cisco sandbox is not open.
So I am working "theoretically" until I get access to the actual PBX
I have assembled this code in order to find the Extension 200. I do not even know if I am searching inside the correct Model.
var req1 = new BroadWorksConnector.Ocip.Models.UserPhoneDirectoryGetListRequest
{
SearchCriteriaExtension = new List<BroadWorksConnector.Ocip.Models.SearchCriteriaExtension>
{
new SearchCriteriaExtension
{
IsCaseInsensitive = false,
Mode = BroadWorksConnector.Ocip.Models.SearchMode.EqualTo,
Value = "200"
}
}
};
try
{
var response = await ocip.CallAsync(req1);
foreach (var row in response.DirectoryTable.Row)
{
Console.WriteLine(row.Col[0]);
}
}
catch (BroadWorksConnector.Ocip.ErrorResponseException ej)
{
SetText(ej.Message.ToString());
}
catch (ValidationException ek)
{
SetText(ek.Message.ToString());
}
Now that I theoretically have the Extension, how can I make the PBX assign a Name on that Extension and open it so it can be usable by the guest?
For the Name part, I have found the GroupVirtualOnNetEnterpriseExtensionsModifyUserRequest but I do not understand how can I set the Name for a specific Extension.
var req2 = new BroadWorksConnector.Ocip.Models.GroupVirtualOnNetEnterpriseExtensionsModifyUserRequest
{
ServiceProviderId = "test-service-provider",
GroupId = "test-group",
CallingLineIdFirstName = "Smith"
};
Generally I cannot understand how can I use this API to selectively modify a value in a model (eg to assign Smith to PhoneNumber 200 or to assign John into Device 234)
Any help appreciated.
Thank you
I think I've come across a bug in the CreateFolder command in the Reportingservices2010 SOAP API
The test scenario is I'm trying to create a folder (named Sales Dashboard) in the same Parent folder (lets say Sales) as a report also named Sales Dashboard.
The command completed with the "AlreadyExists" Exception when the folder does not already exist. It looks like the method isn't checking the catalog item type.
Here's my code:
public static void createFolders(string targetURL, string folderName, string parentPath, string description, string visible)
{
//Build Authentication
ReportingService2010 rs = new ReportingService2010();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rs.Url = targetURL;
//Declare properties
Property descriptionProp = new Property();
Property visibleProp = new Property();
Property[] props = new Property[2];
descriptionProp.Name = "Description";
descriptionProp.Value = description;
visibleProp.Name = "Visible";
visibleProp.Value = visible;
props[0] = descriptionProp;
props[1] = visibleProp;
try
{
rs.CreateFolder(folderName, parentPath, props);
}
catch(Exception ex)
{
if(ex.Message.Contains("AlreadyExists"))
{
//do nothing?
}
else
{
throw;
}
}
}
I wanted to see if I could contribute a fix but there's no GitHub repo for the C# SSRS stuff. Any thought's on a workaround?
The API is returning the correct error since this is a restriction of Reporting Services in general: items within the same folder must have unique names (regardless of item type).
Please be patient I have already gone through the example from: How to Add an Attachment to a User Story using Rally REST .NET
However the sample code requires a query to identify the newest user story reference. The sample illustrates how to add an attachment to an existing user story. I would like to accomplish: Creating a new user story along with an attachment.
Here is my method.
public void createUsWithAttachment(string workspace, string project,
string userStoryName, string userStoryDescription){
//Authenticate with Rally
this.EnsureRallyIsAuthenticated();
//UserStory Setup
DynamicJsonObject toCreate = new DynamicJsonObject();
toCreate[RallyField.workSpace] = workspace;
toCreate[RallyField.project] = project;
toCreate[RallyField.name] = userStoryName;
toCreate[RallyField.description] = userStoryDescription;
//get the image reference - assume that this is where the image lives after being downloaded from Outlook
String imageFilePath = "C:\\Users\\secret\\...";
String imageFileName = "file.png";
String fullImageFile = imageFilePath + imageFileName;
Image myImage = Image.FromFile(fullImageFile);
// Convert Image to Base64 format
string imageBase64String = imageToBase64(myImage, System.Drawing.Imaging.ImageFormat.Png);
// Length calculated from Base64String converted back
var imageNumberBytes = Convert.FromBase64String(imageBase64String).Length;
// DynamicJSONObject for AttachmentContent
DynamicJsonObject myAttachmentContent = new DynamicJsonObject();
myAttachmentContent["Content"] = imageBase64String;
try
{
//create user story
CreateResult createUserStory = _api.Create(RallyField.hierarchicalRequirement, toCreate);
//create attachment
CreateResult myAttachmentContentCreateResult = _api.Create("AttachmentContent", myAttachmentContent);
String myAttachmentContentRef = myAttachmentContentCreateResult.Reference;
Console.WriteLine("Created: " + myAttachmentContentRef);
// DynamicJSONObject for Attachment Container
DynamicJsonObject myAttachment = new DynamicJsonObject();
//Note the below commented line
/*myAttachment["Artifact"] = ;*/
myAttachment["Content"] = myAttachmentContentRef;
myAttachment["Name"] = "AttachmentFromREST.png";
myAttachment["Description"] = "Attachment Desc";
myAttachment["ContentType"] = "image/png";
myAttachment["Size"] = imageNumberBytes;
//create attachment
CreateResult myAttachmentCreateResult = _api.Create("Attachment", myAttachment);
}
catch (WebException e)
{
Console.WriteLine(e.Message);
}
}
In the above commented line I need to get a reference to the created user story which I can do, but that would require another method to fetch the user story which I have.
However I am wondering if this can be accomplished a different way similar to how we can create a user story with the dynamicJsonObject staging.
I was thinking something like this would work, but I am having a tough time.
DynamicJsonObject toCreate = new DynamicJsonObject();
toCreate[RallyField.workSpace] = workspace;
toCreate[RallyField.project] = project;
toCreate[RallyField.name] = userStoryName;
toCreate[RallyField.description] = userStoryDescription;
toCreate["Content"] = imageToBase64;
CreateResult createUserStory = _api.Create(RallyField.hierarchicalRequirement, toCreate);
My above assumption is not going as planned and I was wondering if there is a way to create a new user story with an attachment, without having to query for the userstory reference as neatly illustrated in the example from the link provided.
Thanks and credit to the author from the example in the link.
You should already have what you need to associate it from the create result:
myAttachment["Artifact"] = createUserStory.Reference;
I'm using the ReportService2010 web service (e.g. http://[server]/ReportServer_WLTSQL05/ReportService2010.asmx?wsdl) to upload an SSRS report.
In the GUI front end I am able to go to the properties section of a report and select a check box to 'Hide in Tile View' and would like to perform the same action after uploading my report via the web service. How can I do that?
Currently my code looks like:
var reportProperty = new Property[0];
reportService.CreateCatalogItem(type, reportObjectName, folderPath, true, reportBytes, reportProperty, out warnings);
And I've tried adding different types to the Property array but not achieved success yet.
I've just managed to change this via:
var property = new Property { Name = "Hidden", Value = "true" };
var properties = new Property[1];
properties[0] = property;
reportService.SetProperties(reportObject.Path,properties);
So I went back to the original code and updated it to:
var reportProperty = new Property[1];
var hideProperty = new Property { Name = "Hidden", Value = hideFromTileView.ToString() };
reportProperty[0] = hideProperty;
reportService.CreateCatalogItem(type, reportObjectName, folderPath, true, reportBytes, reportProperty, out warnings);
And it all works now.
We are moving from Reporting Services remote to local,for this i've been converting the rdl files to rdlc successfully and changing the reportviewers to local processing and passing the data source via code like this:
ReportDataSource data = new ReportDataSource("PARAGAINSA", new InventarioRptCs().Selecciona_Saldos_Articulo(locid,
BodId,depid,FamId,NBid,imId,desde,hasta));
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(data);
ReportViewer1.LocalReport.Refresh();
Works great, i've also encounter some reports that have some subreports to pass the data source to the sub reports i've been doing it like this:
ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubReporteHandler);
private void SubReporteHandler(object sender, SubreportProcessingEventArgs e)
{
int im_id = Convert.ToInt32(e.Parameters[1].Values[0].ToString());
int loc_id = Convert.ToInt32(e.Parameters[0].Values[0]);
e.DataSources.Add(new ReportDataSource("PARAGAINSA", new InventarioRptCs().Selecciona_Saldos_Articulo_Det(loc_id,im_id)));
}
it also worked great, so i happily continue until i find a Report that has a subreport and the subreport has this in one of the fields:
when i click on the field that acts as the navigation link to the other report i get this
A data source instance has not been supplied for the data source 'datasource'.
so my question is: is there anyway i can pass the data source to the report inside the sub report that is been call via navigation -> go to report? if so how?
I am using VS 2013, with SQL server 2012
Thank you for reading, pardon my english not my first languague
Since i was not able to find another way to solve this i did the following to try and simulate the navigation between reports that is only available(to my knowledge) in processing mode remote,
First in the rdlc file i added 'Ver mas informacion' in the title property of the column that was acting as the link to the other report and set the Color to blue to give it a link style
i had to add the tooltip(rendes to title attribute) because i was not able to find another way to be able to select those specific cells that i wanted
then a css style to set the Cursor to pointer
[title="Ver mas informacion"] {
cursor:pointer;
}
then a script using jquery to handle the click event geting the values that i need as a parameter to the other report, navigate to the other report and pass the parameter via URL
$(window).load(function () {
$(document).on('click', '[title="Ver mas informacion"]', function () {
var locId = $('[id$="ddLocal"]').val();
var Fecha = $(this).parent().parent()[0].childNodes[2].childNodes[0].innerHTML;
var TT_Id = $(this).parent().parent()[0].childNodes[9].childNodes[0].innerHTML;
var Ap_Id = $(this).parent().parent()[0].childNodes[10].childNodes[0].innerHTML;
window.open(window.location.origin + config.base + '/Reportes/RptSubViewer.aspx?Sub=Doc&Loc=' + locId + '&Fecha=' + Fecha + '&AP=' + Ap_Id + '&TT_Id=' + TT_Id);
});
});
then over the other webform i only added a reportviewer and on the code behind
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (Request.QueryString["Sub"] == "Doc")
{
string _loc = Request.QueryString["Loc"];
string _fecha = Request.QueryString["Fecha"];
string _Ap_Id = Request.QueryString["AP"];
string _TT_Id = Request.QueryString["TT_Id"];
int loc_id = 0, TT_id = 0, Ap_Id = 0;
CultureInfo provider = new CultureInfo("en-US");
DateTime Fecha = DateTime.Now;
if (!string.IsNullOrEmpty(_loc))
loc_id = Convert.ToInt32(_loc);
if (!string.IsNullOrEmpty(_fecha))
Fecha = DateTime.ParseExact(_fecha,"dd/MMM/yyyy",provider);
if (!string.IsNullOrEmpty(_Ap_Id))
Ap_Id = Convert.ToInt32(_Ap_Id);
if (!string.IsNullOrEmpty(_TT_Id))
TT_id = Convert.ToInt32(_TT_Id);
if (TT_id == 14 || TT_id == 15 || TT_id == 21)
{
List<ReportParameter> paramList = new List<ReportParameter>();
paramList.Add(new ReportParameter("LocId", _loc));
paramList.Add(new ReportParameter("Fecha", Fecha.ToShortDateString()));
paramList.Add(new ReportParameter("TT_Id", _TT_Id));
paramList.Add(new ReportParameter("TT_Doc", _Ap_Id));
ReportDataSource data = new ReportDataSource("ARACLDS", new InventarioRptCs().Selecciona_Saldos_Articulo_Doc(loc_id, Fecha, TT_id, Ap_Id).ToList());
RVSubNav.LocalReport.ReportPath = "Rdlcs\\ReporteKardexDoc.rdlc";
RVSubNav.Visible = true;
RVSubNav.LocalReport.SetParameters(paramList);
RVSubNav.LocalReport.DataSources.Clear();
RVSubNav.LocalReport.DataSources.Add(data);
RVSubNav.LocalReport.Refresh();
}
}
}
}
not sure if the best way but it got the job done