We had the September 2016 meetup of the SharePoint Sri Lanka forum in 14th of September. I did a session on Data Loss Prevention (DLP) in SharePoint, which is a new feature of SharePoint 2016.
Following is the presentation I did
We had the September 2016 meetup of the SharePoint Sri Lanka forum in 14th of September. I did a session on Data Loss Prevention (DLP) in SharePoint, which is a new feature of SharePoint 2016.
Following is the presentation I did
Let’s assume that we need to get all pages in a site. Following are the steps we have to perform
Traditionally we would write a code like the below, but it will not provide expected response. This is due to the asynchronous nature of operations
Code that does not work
var context = SP.ClientContext.get_current();
var hostContext = new SP.AppContextSite(context, decodeURIComponent(getQueryStringParameter("SPHostUrl")));var web = hostContext.get_web();
var lists = web.get_lists();
context.load(lists);context.executeQueryAsync(
function () {
var listEnumerator = lists.getEnumerator();
while (listEnumerator.moveNext()) {
var oList = listEnumerator.get_current();
if (oList.get_baseType() === 1) {var camlQuery = new SP.CamlQuery();
var items = list.getItems(camlQuery);
context.load(items);
context.executeQueryAsync(
function () {
var listEnumerator = lists.getEnumerator();}, function (sender, args) {
console.log('error!');
});
}
}
}, function (sender, args) {
console.log('error!');
});
As the solution, I broke the functionality in to two methods using Deferred objects. I’ve written a blogpost on Deferred objects and you can find it from here. Following is the preferred approach.
Working code with Deferred objects
function getSitePages()
{
var context = SP.ClientContext.get_current();
var hostContext = new SP.AppContextSite(context, decodeURIComponent(getQueryStringParameter("SPHostUrl")));var web = hostContext.get_web();
var lists = web.get_lists();
context.load(lists);context.executeQueryAsync(
function () {
var listEnumerator = lists.getEnumerator();
while (listEnumerator.moveNext()) {
var oList = listEnumerator.get_current();
if (oList.get_baseType() === 1) {var promise = getListItems(oList).then(function (state) {
console.log(state);
});}
}
}, function (sender, args) {
console.log('error!');
});
}function getListItems(list) {
var dfd = $.Deferred();var context = SP.ClientContext.get_current();
var hostContext = new SP.AppContextSite(context, decodeURIComponent(getQueryStringParameter("SPHostUrl")));
var camlQuery = new SP.CamlQuery();
camlQuery.ViewFields = "<FieldRef Name='FileExtension' /><FieldRef Name='Title' />";
camlQuery.set_viewXml("<View><Query><Where><Or><Contains><FieldRef Name='FileLeafRef' /><Value Type='Text'>.aspx</Value></Contains><Contains><FieldRef Name='FileLeafRef' /><Value Type='Text'>.html</Value></Contains></Or></Where></Query></View>");
var items = list.getItems(camlQuery);
context.load(items);context.executeQueryAsync(
function () {
var itemsCount = items.get_count();
if (itemsCount > 0) {
obj = {};
obj.ListName = list.get_title();
obj.ListPages = [];for (var i = 0; i < itemsCount; i++) {
var item = items.itemAt(i);
obj.ListPages.push(item.get_item('FileRef'));
}dfd.resolve(obj);
}
}, function (sender, args) {
dfd.reject(sender, args, errorMsg);
});return dfd.promise();
}
One of my SharePoint environment had all SharePoint related services configured in one server (Single server topology). PowerPivot service application was one of them. Due to various reasons the Server had very limited resources.
Due to resource limitation, I was getting the above issue repeatedly. Until I upgrade the server I performed following actions to resolve the issue.
1. Restart PowerPivot instance in my SQL Server
2. Navigate to Manage Service Applications > Excel Services Application > Data Model Settings, and check the PowerPivot instance is available
3. Navigate to “Service on this Server” and restart “Excel Calculation Services” service
4. Navigate to “Service on this Server” and restart “SQL Server PowerPivot System Service ” service
5. Check the firewall and the network connectivity between SharePoint server and PowerPivot SQL instance
The largest online conference for SharePoint, Office365 and Azure is just around the corner. I will be speaking on the topic of “SharePoint Framework the future of SharePoint development”
You can register by navigation to this site
SharePoint Framework
SharePoint Framework, a page and part model that enables fully supported client-side development, easy integration with the Microsoft Graph and support for open source tooling. This will be the trend for any SharePoint customization. In this session I will describe the SharePoint framework and walkthrough a practicel sample which uses AngularJS and Kendo UI. Furthermore I will talk about the approach we take to migrate current SharePoint solutions to the SharePoint Framework
In this session I will try to talk about the following
I had to implement Disaster Recovery (DR) strategy to one of my SharePoint farms deployed in Microsoft Azure. I used Azure Recovery Services to achieve the goal in addition to SharePoint site collection backups.
Following are the steps I used to create a recovery vault in my Microsoft Azure environment to protect my Virtual Machines
1. Look for Recovery Services vaults in Azure portal
2. Create a new vault
3. Select if you need locally redundant or geo-redundant storage. I selected locally redundant storage as my budget was limited
4. In this section we are creating a new Backup policy for Virtual Machines
5. In backup policy, specify required retention
6. Add virtual machines to the backup policy
7. Click on backup jobs to see the current status
8. We can see the backup configuration task has completed
9. But that’s not all. We have to execute the initial backup. Click on Azure Virtual Machines node to navigate to check current status
10. We have to select one Virtual Machine at a time to execute the initial backup
11. Once we run the initial backup job for each and every Virtual Machine in our SharePoint farm, we can see a result similar to the following
12. Once it is backed up according to the schedule, we can check the latest restore point as shown below
That is the easiest way to implement disaster recovery for a SharePoint farm hosted in Microsoft Azure.
One of my SharePoint environments was recently deployed in Microsoft Azure IaaS. I have following servers in that environment
I have deployed the farm accordingly and created host named site collection using public URL “portal.contoso.com”.
I used following command to create the host based site collection
New-SPSite 'https://portal.contoso.com' -HostHeaderWebApplication 'https://portal.contoso.com' -Name 'Portal' -Description 'Portal' -OwnerAlias 'SP\SP_Admin' -language 1033 -Template 'BLANKINTERNETCONTAINER#0'
Then I mapped the public IP of the SharePoint server with my external DNS. Thereafter my SharePoint site is accessible from outside as below
But the public URL was not accessible within my server farm (e.g SharePoint server, or Analysis Services Server), And I need to have a more concrete solution than host files.
Following are the steps I used
1. Log in to domain controller and navigate to DNS Manager. Right click on Forward Lookup Zones and create new
2. Create new A record to SharePoint server
3. Test the connectivity
First clear the DNS cache
- ipconfig /flushdns
That’s all we have to do. In the same way I had to map public URLs of my analysis services as well.
I have recently deployed a SharePoint farm in Microsoft Azure Infrastructure as a Service (IaaS). That server farm contains following servers.
Furthermore I’ve configured Point-to-Site VPN connectivity as well. Following is how the environment was structured.
Everything looks good until I received a request to move everything to a different network address space. It seems that there was an internal network range which conflicts with my 11.0.0.0/16 address space. The only option is to move to a new virtual address space.
Following was the desired configuration.
I had few challenges to overcome
Luckily I got recommendations from my good friend Janaka and received a great help from Denny Cherry to find a solution. This post is written to summarize the approach I took to move my environment to a new address space.
Okay. Let’s start the migration.
Following are the steps I followed.
1. Stop and deallocate all servers in the environment.
2. In Domain Controller remove the static IP assignment
3. Add a new Address Space in Virtual Network
4. Add new Subnets in that Address Space
5. I have to execute some PowerShell commands. I need to get the names of network cards in each server prior to that
6. First we need to connect to the environment
Login-AzureRMAccount
Get-AzureRmSubscription
Get-AzureRmSubscription –SubscriptionName "My Subscription" | Select-AzureRmSubscription –SubscriptionName "My Subscription"
7. Declare variables
$rgname = "TRS-Test-Res-01"
$vnetname = "TRS-Test-Net-01"
$subnetName1 = "TRS-Test-Sub-01"
$subnetName2 = "TRS-Test-Sub-02"$adNICName = "trs-test-dc-01646"
$fsNICName = "trs-test-fs-01971"
$dbNICName = "trs-test-db-01899"
$asNICName = "trs-test-as-01350"
$spNICName = "trs-test-sp-01892"
8. Get Virtual Network and Subnets
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName $rgname -Name $vnetname
$subnet1 = Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name $subnetName1
$subnet2 = Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name $subnetName2
9. Migrate the first server (Domain Controller)
$nicAD = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $adNICName
$nicAD.IpConfigurations[0].Subnet = $subnet1
Set-AzureRmNetworkInterface -NetworkInterface $nicAD
I have to do some extra steps to update the DNS server (Activities from step 10 to step 13).
10. Start the Domain Controller server
11. In Virtual Network set the custom DNS
But still it shows 11.0.0.4 as the DNS server, when I checked within the domain controller
12. Execute following commands and restart the domain controller
13. Check ipconfig /all again after the restart
Now the DNS servers are updated properly
14. Now we have to migrate other servers
#File Server
$nicFS = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $fsNICName
$nicFS.IpConfigurations[0].Subnet = $subnet1
Set-AzureRmNetworkInterface -NetworkInterface $nicFS
#SSAS Server
$nicAS = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $asNICName
$nicAS.IpConfigurations[0].Subnet = $subnet1
Set-AzureRmNetworkInterface -NetworkInterface $nicAS
#DB Server
$nicDB = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $dbNICName
$nicDB.IpConfigurations[0].Subnet = $subnet2
Set-AzureRmNetworkInterface -NetworkInterface $nicDB
#SharePoint Server
$nicSP = Get-AzureRmNetworkInterface -ResourceGroupName $rgname -Name $spNICName
$nicSP.IpConfigurations[0].Subnet = $subnet2
Set-AzureRmNetworkInterface -NetworkInterface $nicSP
15. Once all servers are migrated we need to restart them
16. Now we can delete Subnets from my previous environment (TRS-Test-Sub-01 and TRS-Test-Sub-02)
17. Later we can delete the Address Space of my previous environment
That’s all I had to do. Hope this helps someone .
When we access a SharePoint site outside the domain, we get the annoying login prompt although we ask our browser to remember our credentials
How to get rid of that login prompt and automatically navigate to the site. Following were the steps I used
Settings in Internet Options
Settings in Credentials Manager
That’s all we have to do.