Creating and configuring SharePoint 2013 reporting services

Powershell for configuring Reporting services in SP mode

Copied from  https://msdn.microsoft.com/en-us/library/jj219068.aspx#bkmk_full_script

#This script Configures SQL Server Reporting Services SharePoint mode

$starttime=Get-Date
write-host -foregroundcolor DarkGray StartTime>> $starttime

Write-Host -ForegroundColor Green “Import the SharePoint PowerShell snappin”
Add-PSSnapin Microsoft.Sharepoint.Powershell –EA 0

Write-Host -ForegroundColor Green “Install SSRS Service and Service Proxy, and start the service”
Write-Host -ForegroundColor Green “>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>”

Write-Host -ForegroundColor Green “Install the Reporting Services Shared Service”
Install-SPRSService

Write-Host -ForegroundColor Green ” Install the Reporting Services Service Proxy”
Install-SPRSServiceProxy

# Get the ID of the RS Service Instance and start the service
Write-Host -ForegroundColor Green “Start the Reporting Services Service”
$RS = Get-SPServiceInstance | Where {$_.TypeName -eq “SQL Server Reporting Services Service”}
Start-SPServiceInstance -Identity $RS.Id.ToString()

# Wait for the Reporting Services Service to start…
$Status = Get-SPServiceInstance $RS.Id.ToString()
While ($Status.Status -ne “Online”)
{
Write-Host -ForegroundColor Green “SSRS Service Not Online…Current Status = ” $Status.Status
Start-Sleep -Seconds 2
$Status = Get-SPServiceInstance $RS.Id.ToString()
}

$time=Get-Date
write-host -foregroundcolor DarkGray StartTime>> $starttime
write-host -foregroundcolor DarkGray $time

Write-Host -ForegroundColor Green “Create a new application pool and Reporting Services service application”
Write-Host -ForegroundColor Green “>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>”
Write-Host -ForegroundColor Green “Create a new application pool”
#!!!! update “-Account” with an existing Managed Service Account
New-SPServiceApplicationPool -Name “Reporting Services” -Account “<domain>\User name>”
$appPool = Get-SPServiceApplicationPool “Reporting Services”

Write-Host -ForegroundColor Green ” Create the Reporting Services Service Application”
#!!!! Update “-DatabaseServer”, an instance of the SQL Server database engine
$rsService = New-SPRSServiceApplication -Name “Reporting Services Application” -ApplicationPool $appPool -DatabaseName “Reporting_Services_Application” -DatabaseServer “<server name>”

Write-Host -ForegroundColor Green “Create the Reporting Services Service Application Proxy”
$rsServiceProxy = New-SPRSServiceApplicationProxy -Name “Reporting Services Application Proxy” -ServiceApplication $rsService

Write-Host -ForegroundColor Green “Associate service application proxy to default web site and grant web applications rights to SSRS application pool”
Write-Host -ForegroundColor Green “>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>”
# Associate the Reporting Services Service Applicatoin Proxy to the default web site…
Get-SPServiceApplicationProxyGroup -default | Add-SPServiceApplicationProxyGroupMember -Member $rsServiceProxy

$time=Get-Date
write-host -foregroundcolor DarkGray StartTime>> $starttime
write-host -foregroundcolor DarkGray $time

Write-Host -ForegroundColor Green “Enable the PowerView and reportserver site features”
Write-Host -ForegroundColor Green “>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>”
#!!!! update “-url” of the site where you want the features enabled
Enable-SPfeature -identity “powerview” -Url http://server/sites/bi
Enable-SPfeature -identity “reportserver” -Url http://server/sites/bi

####To Verify, you can run the following:
#Get-SPRSServiceApplication
#Get-SPServiceApplicationPool | where {$_.name -like “reporting*”}
#Get-SPRSServiceApplicationProxy
Other reference /help

http://www.c-sharpcorner.com/UploadFile/shyjumohan/create-reporting-services-service-application-in-sharepoint/

For errors :

https://support.microsoft.com/en-us/kb/889646

 

 

Advertisements

Configure SharePoint APPs in development Server

—————–Steps for Creation of an isolated app domain on development computer —————————-
1:Start the SharePoint 2013 Management Shell.

net start spadminv4
net start sptimerv4

Create your isolated app domain your apps, for example “apps.developement.local”.
1:Set-SPAppDomain “apps.developement.local”

Ensure that the SPSubscriptionSettingsService and AppManagementServiceInstance services are running.
1:Get-SPServiceInstance | where{$_.GetType().Name -eq “AppManagementServiceInstance” -or $_.GetType().Name -eq “SPSubscriptionSettingsServiceInstance”} | Start-SPServiceInstance

Verify that the SPSubscriptionSettingsService and AppManagementServiceInstance services are running.
1:Get-SPServiceInstance | where{$_.GetType().Name -eq “AppManagementServiceInstance” -or $_.GetType().Name -eq “SPSubscriptionSettingsServiceInstance”}
–To create new Manage account [run the below command if manage account is not present——

$account = New-SPManagedAccount

After that run below commands:

$account = Get-SPManagedAccount “domainname\username”
$appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
$appPoolAppSvc = New-SPServiceApplicationPool -Name AppServiceAppPool -Account $account
$appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName SettingsServiceDB
$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc
$appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name AppServiceApp -DatabaseName AppServiceDB
$proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
Set-SPAppSiteSubscriptionName -Name “app” -Confirm:$false

 

Rest API code to add folders to SharePoint Library

I have a requirement to add folders to library from client side .The requirement is like when a file will upload to a library it will check for the folder structure like current year->current Month->current Date .If folders are not there folder should be created and file will be upload to the current date folder.So here I am uploading the iterative folder creation with a structure of   lib name->2016->6->13062016  .

This is basically a rough code not managed well.

 

var date = new Date();
var month = date.getMonth() + 1;
var year = date.getFullYear();
//var dateF = date.format(‘d-M-Y’);dd-MM-yy
var dateF = date.format(‘dd-MM-yyyy’);
var dateURL = “”;
var list = [];
var flag;

$(document).ready(function () {

$(“#btnClick”).click(function () {

var folderURL = “test”;
var numbers = { “year”: year, “month”: month, “date”: dateF, “listarray”: “” };
var folderDisplyURL=””;
$.each(numbers, function (index, value) {

if (index == “year”) {

folderURL1 = publicMethod.GetFolder(year, folderURL, “year”);

}
else if (index == “month”) {

folderURL1 = publicMethod.GetFolder(month, folderURL + “/” + year, “month”);

}
else if (index == “date”) {

folderURL1 = publicMethod.GetFolder(dateF, folderURL + “/” + year + “/” + month, “date”);

}
else if (index == “listarray”) {
$.each(list, function (index, value) {

var pCreate = $.ajax({
“url”: _spPageContextInfo.webAbsoluteUrl + “/_api/Web/Folders/add(‘” + value + “‘)”,
“type”: “POST”,
async: false,
“headers”: {
“accept”: “application/json; odata=verbose”,
“content-type”: “application/json; odata=verbose”,
“X-RequestDigest”: $(“#__REQUESTDIGEST”).val()
}
});

$.when(pCreate).always(function (data) {

try {
flag = “created”;
folderDisplyURL = _spPageContextInfo.webAbsoluteUrl + data.d.ServerRelativeUrl;
}
catch (err) {

}

});

});
}

if (folderDisplyURL != “”) {

if (flag == “created”) {
alert(“Folder created URL :” + folderDisplyURL);
}
}
});

});
});

var publicMethod =
{
GetFolder: function (folderName, folderURL, flag) {

var folderURL2 = “”;

var requestUri = _spPageContextInfo.webServerRelativeUrl + “/_api/Web/GetFolderByServerRelativeUrl(‘” + folderURL + “‘)/Folders?$filter=Name eq ‘” + folderName + “‘”;
)
var returnURL = “”;
$.ajax(
{
url: requestUri,
type: “GET”,

data: JSON.stringify({ ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘ServerRelativeUrl’: folderURL }),
headers: {
“accept”: “application/json;odata=verbose”
},
success: onSuccess,
error: onError,
async: false
}
);

function onSuccess(data) {

if (data.d.results.length == 0) {
list.push(folderURL+”/”+folderName);

}
}

function onError(error) {

}
return folderURL2;

},

getFormDigest: function (webUrl) {
return $.ajax({
url: webUrl + “/_api/contextinfo”,
method: “POST”,
headers: { “Accept”: “application/json; odata=verbose” }
});
},
CreatF: function (folderURL, folderName)
{
var requestUri = _spPageContextInfo.webAbsoluteUrl + “/_api/web/folders”;
$.ajax({
url: requestUri,
type: “POST”,
data: JSON.stringify({ ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘ServerRelativeUrl’: folderURL + “/” + folderName }),
headers: {
“accept”: “application/json;odata=verbose”,
“content-type”: “application/json;odata=verbose”,
“X-RequestDigest”: $(“#_REQUESTDIGEST”).val()
},
success: onSuccess1,
error: onError1
});

function onSuccess1(data) {
debugger;
alert(folderName+’Folder created successfully’);
}

function onError1(error) {
debugger;
alert(JSON.stringify(error));
}
},
CreateFolder: function (folderURL) {

var requestUri = _spPageContextInfo.webAbsoluteUrl + “/_api/web/folders”;
return publicMethod.getFormDigest(_spPageContextInfo.webAbsoluteUrl).then(function (data) {
$.ajax(
{
url: requestUri,
type: “POST”,
async: false,
data: JSON.stringify({ ‘__metadata’: { ‘type’: ‘SP.Folder’ }, ‘ServerRelativeUrl’: folderURL }),
headers: {
“accept”: “application/json;odata=verbose”,
“content-type”: “application/json;odata=verbose”,
//”X-RequestDigest”: $(“#_REQUESTDIGEST”).val()
“X-RequestDigest”: data.d.GetContextWebInformation.FormDigestValue
},
success: onSuccess1,
error: onError1

}
);
function onSuccess1(data) {
debugger;
alert(folderURL + ‘ Folder created successfully’);

}

function onError1(error) {
debugger;

alert(JSON.stringify(error));
}
});
return folderName;

},
}

How to connect to AZURE DB from your local SSMS

Full Post :

Connect to SQL Server on Azure VM via Local SSMS

Working with SPservices

Reference :

 

SPServices Stories #2 – Charting List Data with HighCharts

Caml Query For User Type field

Option 1 –  If you know the display name of the user

 <Where>
   <Eq>
      <FieldRef Name='User_x0020_ID' />
      <Value Type='User'>System Account</Value>
   </Eq>
 </Where>

Option 2 – If you know the User Id ( not the login id)

 <Where>
    <Eq>
       <FieldRef Name='User_x0020_ID' LookupId='True'  />
       <Value Type='User'>1073741823</Value>
    </Eq>
 </Where>

Option 3 – If you would like to filter based on current user (logged in User )

 <Where>
    <Eq>
       <FieldRef Name='User_x0020_ID'/>
       <Value Type='User'><UserID/></Value>
    </Eq>
 </Where>