Skip to content

Instantly share code, notes, and snippets.

Vincent Rothländer Vintaurus

Block or report user

Report or block Vintaurus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Set-ProvisioningTemplate.ps1
function Set-WebPart($fileName, $webPart, $ZoneId, $ZoneIndex, $listName, $isRootWeb) {
$web = Get-PnPWeb -Includes "ParentWeb"
#Destination page where the web part will be added
$serverRelativePageUrl = $web.ServerRelativeUrl + "/SitePages/" + $fileName
#Location for all web part XML-files
$directory = Get-Location
#web part file path
$file = $directory.Path + "\" + $webPart
#create new web part file path for updating information
$newFile = $file.Replace(".xml", "_new.xml")
View Set-ProvisioningTemplate.ps1
Apply-PnPProvisioningTemplate -Path $rootsiteTemplateFileName -ClearNavigation
View Set-ProvisioningTemplate.ps1
Connect-PnPOnline -Url $siteUrl -CurrentCredentials
Apply-PnPProvisioningTemplate -Path $rootsiteTemplateFileName -ClearNavigation
Set-WebPart -fileName $startPageFileName -webPart "webpart_Start.aspx_1.xml" -ZoneId "Header" -ZoneIndex 0
Set-WebPart -fileName $startPageFileName -webPart "webpart_Start.aspx_2.xml" -ZoneId "Header" -ZoneIndex 1
Set-WebPart -fileName $startPageFileName -webPart "webpart_Start.aspx_3.xml" -ZoneId "Header" -ZoneIndex 2
Set-WebPart -fileName $myTaskPageFileName -webPart "webpart_MyTasks.aspx_2.xml" -ZoneId "MiddleColumn" -ZoneIndex 0
Set-WebPart -fileName $myTaskPageFileName -webPart "webpart_MyTasks.aspx_3.xml" -ZoneId "LeftColumn" -ZoneIndex 0
Disconnect-PnPOnline
View UploadReports.cs
string directoryReportFile = "D:\upload\Reports\DailyReport.rdl";
string reportFileName = Path.GetFileName(datasetFile);
string reportFullUrl = string.Concat("http://sharepoint/dashboard/Reports/", reportFileName)
SPList reportLibrary = <Reports>;
//First upload all report files
using(FileStream fileStream = File.OpenRead(directoryDatasetFile))
{
reportLibrary.Files.Add(datasetFileName, fileStream, true);
}
View UploadReports.cs
string directoryDatasetFile = "D:\upload\Report_Dataset.rsd";
string datasetFileName = Path.GetFileName(datasetFile);
string datasetFullUrl = string.Concat("http://sharepoint/dashboard/Data Connections/Datasets/", datasetFileName)
SPFolder folder = ....; //get folder "Datasets" from library "Data Connections"
using(FileStream fileStream = File.OpenRead(directoryDatasetFile))
{
folder.Files.Add(datasetFileName, fileStream, true);
}
View UploadReports.cs
string dataConnectionsLibraryUrl = "http://sharepoint/dashboard/Data Connections/DataSources"
string directorySourceFile = "D:\upload\Reporting.SSAS.Tabular.rds";
//Need to change file extension for SharePoint
string sourceFileName = Path.GetFileName(directorySourceFile).Replace("rds", "rsds");
//Relevant for dataset property
string dataSourcesFileFullUrl = string.Concat(dataConnectionsLibraryUrl, sourceFileName);
XmlNode extensionNode = null;
XmlDocument xDocument = new XmlDocument();
View UploadReports.cs
ReportingService2010 reportingService = new ReportingService2010();
reportingService.Url = "http://sharepoint/dashboard/_vti_bin/ReportServer/ReportService2010.asmx";
reportingService.Credentials = System.Net.CredentialCache.DefaultCredentials;
View UploadReports.cs
var directoryDataSourcesFiles = Directory.GetFiles(uploadReportFolderPath + "\\" + Constants.DirectoryFolder.DataSources);
var directoryDatasetFiles = Directory.GetFiles(uploadReportFolderPath + "\\" + Constants.DirectoryFolder.Datasets);
var directoryReportFiles = Directory.GetFiles(uploadReportFolderPath + "\\" + Constants.DirectoryFolder.Reports);
LoadReportingService();
using (SPSite siteColl = new SPSite(dashboardWebUrl))
using (SPWeb site = siteColl.OpenWeb())
{
IList<DataSourceFile> dataSourceFiles = UploadAndConfigureDataSourceFiles(site, directoryDataSourcesFiles);
View Default.aspx.cs
using Microsoft.SharePoint.Client;
using System;
using System.Text;
using System.Web;
namespace BlogNoneSpFullPageWeb
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
View Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BlogNoneSpFullPageWeb.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>vintaurus.weeebly.com</title>
<link href="../Content/bootstrap.min.css" rel="stylesheet" />
<link href="../Content/bootstrap-theme.min.css" rel="stylesheet" />
<script type="text/javascript" src="../Scripts/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../Scripts/bootstrap.min.js"></script>
You can’t perform that action at this time.