Office 365 navigation bar – New Feature -Pin apps to the navigation bar


With all improvements and enhancements, another best feature has started to roll out from today in office 365.

The app launcher enables you to navigate across your services and apps in Office 365. we can can also pin up to three apps in navigation bar .

This makes those apps available instantly, from any Office 365 page or app.It will be more beneficial for the admin users.

navigation bar short cut

 

Advertisements

Remove-PnPUserFromGroup -SharePoint Online (PnP Power Shell)


SharePoint/PnP-PowerShell has provide a great efforts to minimize code and increase productivity in SharePoint Online Development.

Recently we have to remove bulk amount of user from SharePoint Group. We decided to go with pnp power shell script to do it. As per the document Link – Remove User From Group below is the code.

Remove-PnPUserFromGroup -LoginName <String>
                        -Identity <GroupPipeBind>
                        [-Web <WebPipeBind>]
i.e.
PS:> Remove-PnPUserFromGroup -LoginName user@company.com -GroupName 'Marketing Site Members'



But above code didn't work. 

Actually we have to provide the -LoginName string like "i:0#.f|membership|user@contoso.com"
and its work.Below is the working script.
Remove-PnPUserFromGroup -LoginName "i:0#.f|membership|abdul.aziz@contoso.com" -GroupName 'Document'

 

 

Remove All Items in List using MS PnP Powershell – SharePoint Online


I am sharing the below power shell snippet to help my fellows to remove all items in a list in the SharePoint online. Often we need to delete items at once using power shell or through JS code. PNP Power shell make it more easier to complete our task. (hats off)

Copy and paste the below code, it will loop through to a list and remove the item. Change the List name as yours.

Connect-PnPOnline –Url https://*********************

$items =Get-PnPListItem -List “ListName” -PageSize 1000

foreach ($item in $items)
{
try
{
Remove-PnPListItem -List “ListName” -Identity $item.Id -Force
}
catch
{
Write-Host “error”
}

} #for each end

To install PNP Power shell check the PnP PowerShell overview.

#Sharing is caring

Skype for Business integration in Yammer


Yammer is very cool social media plugin within the office. It makes more strong bonding among departments. We found it very useful tool in our organization. With the new Roadmap plan, MS has enhanced its features with Some basic options.

Beginning July 2017, Yammer users with a Skype for Business subscription will start seeing the Skype for the Business icon on the Office 365 navigation bar in Yammer.

This message is associated with Office 365 Roadmap ID 14805.

On the navigation bar, click (or tap) the Skype for Business icon ( Skype for Business icon on the Office 365 navigation bar ).

Choose the Skype for a Business task that you want to do.

 

Search for people in your organization

  1. Click (or tap) the magnifying glass ( Search for contacts ).
  2. In the search box, type the name of who you want to contact.
  3. Select the person from the contacts list.
  4. To add the person to your contacts list, click Add To Contacts.

 

View your contacts list

  1. Click (or tap) the address book icon ( View your contacts list ).
  2. Choose a contact from the list or search for someone else.

Start a conversation

  1. Click (or tap) the plus sign ( Start a conversation ).
  2. In the conversation window, type your message.
How does it affect me?
Yammer users with Skype for Business subscription can now launch and perform some basic Skype for Business tasks right from their Office 365 navigation bar in Yammer.
This feature will initially be available for first release customers and will start rolling out to a subset of production customers starting mid-July, with the majority of customers receiving this update by the end of July.
What do I need to do to prepare for this change?
This feature will be on by default. While no action is required,

SharePoint Online Establishing a new dedicated page for Site usage – 30 June 17 Update


Site usage is like a dashboard to of any site in the SP Online. How many Visit, How Many new items and all highlighted items, documents show to admin. It is very helpful for the site admin to draw a clear picture for the content and statistics.

Previously these reports show on the site content page, in the modern site in SharePoint and  a site owner would see site usage information at the top of the Site contents page.

Site usage on site content page
Site usage on site content page

Now MS has established a dedicated page for the site usage. They have moved this analytics portion to a dedicated page. The Site contents page maintains focus on access and management of content (lists, libraries, pages, etc.), and provides insights into how your site is being used via this new Site usage page.

Site Usage option to show on dedicated page
Site Usage option to show on dedicated page

 

his message is associated with Office 365 Roadmap ID 16048.

It ‘ll begin gradually rolling this out in the following days (June 29 17), and the rollout will be completed by the end of July.

What do I need to do to prepare for this change?
There is nothing you need to do to prepare this change. Please click Additional Information to learn more.

Upload Docs to SharePoint Library & Update Columns using Pnp.js


Microsoft SharePoint Pattern and practices libraries makes it very simple to deal with SharePoint site. Less code and easy to understand. Link to SharePoint PNP-JS-Core.

In this article I will use pnp.js library to upload document and update the other fields in the same item uploaded in SharePoint document library.

(1 ) We need to reference the 4 files to work with pnp.js

/SiteAssets/4.0.5/es6-promise.js
/SiteAssets/4.0.5/es6-promise.auto.js
/SiteAssets/pnp.js
/SiteAssets/fetch.js

 

(2)I have reference the bootstrap in my page and use bootstrap classes.

Html of upload file, I have attached the link of Html Code in the PDF file, just copy and paste.

(3)  Now Call Simple JS Function UploadFiles() to Upload file and update the fields in the same item uploaded. Copy the below Code in JS File.

function UploadFiles() {
var files = document.getElementById(‘exampleInputFile’).files;
var file = files[0]; //using File Api
if (file!=undefined || file!=null){
$pnp.sp.web.getFolderByServerRelativeUrl(“/Documents”)
.files.add(file.name, file, true)
.then(function (data) {
var RelativeUrls=”/Documents/”+file.name;

//Retrive Document which is uploaded. Start
$pnp.sp.web.getFolderByServerRelativeUrl(RelativeUrls).getItem().then(item => {
//update start Below Call to Doc List will update the Row baseed on Item.ID
$pnp.sp.web.lists.getByTitle(“Documents”).items.getById(item.ID).update({
ColumnName: ‘New Value’
}).then(r => {
alert(file.name + ” upload successfully!”);
});
//update end
}); //Retrive Doc Info End
}); //Upload Document End

}

 

 

Below are the References to pnp js core library to deal with files and update item by id.  PDF file contain the html part.

Links

SharePoint Remote Event Receiver – Item Deleting – Using Provider hosted App


Scenario : We need to capture the person who delete the item in the document in SharePoint. On item deletion event will fire and add item to another list for further record. Code is attached and screen shorts are below step by step.

We have implemented a Remote Event Receiver on Document Library by Provider hosted app.

Pre-Requisites:(1) Office Developer Tool for VS2013  or VS2015, (2) Office 365 Subscription (3) Azure Subscription to host website over ssl.

  • First Create the SharePoint Add-In.
Select SharePoint Project
Select SharePoint Project

 

Select the SharePoint version

2

Select the SharePoint version

3

Choose the web project which will host the web service. As I am a big fan of MVC, So I select MVC.

 

4

 

SharePoint Will Create Two Project one is SharePoint – Add in (App) which will reside in our App Catalog in our SharePoint.

Another web MVC project will host the web services, as SharePoint Event Remote Event Receivers use web services, Client Secret and Client ID to communicate for any event.

Now we will Add Events on our App Installing and App Uninstalling Events. I.e. Whenever App Install, our App will call web service to run one Process Method.

Right Click on our App Solution and Click for properties.

 

5

 

Once we Make Handle App Installed True, VS will create a AppEventServices.svc in our web project.

6

 

 

In AppEventReceivers.svc file a Process Methods Function we will Attached Event to the Doc Library on Item Deleting.

Below mentioned the Receiver Name, and the List Name on which we want to Add Event i.e. Document Library and the Destination List Name

7

Below mentioned is the Process Event Methods which run all the time.

8-b

 

In the Process Event Methods,

8

 

On App Installed Event i.e. when we add App to Site AppInstalled Event will occur. If Event not Exists than attached Event on ItemDeleting

 

 

 

9 10

If ItemDeleting occurs in the Document Library mentioned in the above than HandleItem event will occur.

11

 

12

 

Inside AddItem using CSOM to Add item to the List.

13

Now Build Solution, We are ready to register the website so that they will communicate with SharePoint using Client ID and Client Secret.

 

Go the App Catalog site and open the appregnew.aspx in the layouts.

 

 

14

 

Take the Client ID, Client Secret, and Title of the projects. App Domain the website name (The Azure site or any public hosting Site which can host this web).

 

Redirect url will be the default page of the site of hosted web.

 

To Host our web, we will use Azure which can communicate to SharePoint during item deleting event over ssl.

 

We will go to Azure web portal add new web.

 

15

 

Give any name. Export the publishing profile

 

16

 

For publishing profile, go the new created site, click on overview, Click on Get Publshing profile and export to your pc. This will help to publish the web from VS.

 

17 18 19

Click Create. This will give the details, save it we will need the Client ID and Client Secret to enter in the app and in the website to Communicate. By doing this SP (SharePoint) will know the handshake token.

 

20

 

Now Bind the app and the website using the Client ID and Client Secret. Open the AppMenifex.xml from app. Right Click on show code.

 

 

21

 

Enter the Client ID which we taken previously. This will alert SharePoint that whoever take this ID is can go next step.

 

22

Open the webconfig of website and enter the client secrect and client id.

 

23

 

Leave everything as it is.

 

Now publish the web to azure with the publishing profile.

 

24 25 26

Now publish app as .app file and upload to app catalog.

It will pop up to confirm the Client ID.

 

27

 

 

28

 

Summary.

 

Make sure that the below List and Document Library should exists on the Destination site.

 

29

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.EventReceivers;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace VDC_AppWeb.Services
{
public class AppEventReceiver : IRemoteEventService
{

private const string ReceiverName = “ItemDeleting”;
private const string ListName = “VDC Documents”;
private const string DestiNationList = “DestList”;
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
{

SPRemoteEventResult result = new SPRemoteEventResult();
switch (properties.EventType)
{
case SPRemoteEventType.AppInstalled:
HandleAppInstalled(properties);
break;
case SPRemoteEventType.AppUninstalling:
HandleAppUninstalling(properties);
break;
case SPRemoteEventType.ItemDeleting:
HandleItem(properties);
break;
}
return result;
}

private void HandleAppInstalled(SPRemoteEventProperties properties)
{
using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, false))
{
if (clientContext != null)
{
List myList = clientContext.Web.Lists.GetByTitle(ListName);
clientContext.Load(myList, p => p.EventReceivers);
clientContext.ExecuteQuery();
bool rerExists = false;
foreach (var rer in myList.EventReceivers)
{
if (rer.ReceiverName == ReceiverName)
{
rerExists = true;
System.Diagnostics.Trace.WriteLine(“Found existing ItemDeleted receiver at ” + rer.ReceiverUrl);
}
}
if (!rerExists)
{
EventReceiverDefinitionCreationInformation receiver = new EventReceiverDefinitionCreationInformation();
receiver.EventType = EventReceiverType.ItemDeleting;
OperationContext op = System.ServiceModel.OperationContext.Current;
Message msg = op.RequestContext.RequestMessage;
receiver.ReceiverUrl = msg.Headers.To.ToString();
receiver.ReceiverName = ReceiverName;
receiver.Synchronization = EventReceiverSynchronization.Synchronous;
myList.EventReceivers.Add(receiver);
clientContext.ExecuteQuery();
System.Diagnostics.Trace.WriteLine(“Added ItemDeleted receiver at ” + msg.Headers.To.ToString());
}
}
}
}

private void HandleAppUninstalling(SPRemoteEventProperties properties)
{
using (ClientContext clientContext =
TokenHelper.CreateAppEventClientContext(properties, false))
{
if (clientContext != null)
{
List myList = clientContext.Web.Lists.GetByTitle(ListName);
clientContext.Load(myList, p => p.EventReceivers);
clientContext.ExecuteQuery();

var rer = myList.EventReceivers.Where(
e => e.ReceiverName == ReceiverName).FirstOrDefault();

try
{
System.Diagnostics.Trace.WriteLine(“Removing ItemDeleted receiver at ”
+ rer.ReceiverUrl);

//This will fail when deploying via F5, but works
//when deployed to production
rer.DeleteObject();
clientContext.ExecuteQuery();

}
catch (Exception oops)
{
System.Diagnostics.Trace.WriteLine(oops.Message);
}

}
}
}

private void HandleItem(SPRemoteEventProperties properties)
{
using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
if (clientContext != null)
{
try
{
List photos = clientContext.Web.Lists.GetById(properties.ItemEventProperties.ListId);
ListItem item = photos.GetItemById(properties.ItemEventProperties.ListItemId);
// FieldUserValue fvv2 = (FieldUserValue);

clientContext.Load(item);
clientContext.ExecuteQuery();
string Titles = Convert.ToString(item[“FileLeafRef”]);
string Location = Convert.ToString(item[“FileRef”]); ;
string FinalLocation = Location.Replace(Titles, ” “);
string CreatedBys = properties.ItemEventProperties.UserDisplayName;
item.Update();
clientContext.ExecuteQuery();

AddItem(Titles, CreatedBys, FinalLocation, properties);
}
catch (Exception oops)
{
System.Diagnostics.Trace.WriteLine(oops.Message);
}
}
}
}
private void AddItem(string Title, string User, string Location, SPRemoteEventProperties properties)
{

using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
{
if (clientContext != null)
{
List oList = clientContext.Web.Lists.GetByTitle(“VDC Delete Info”);

ListItemCreationInformation listItemCreationInfo = new ListItemCreationInformation();
ListItem oListItem = oList.AddItem(listItemCreationInfo);
oListItem[“Title”] = Title;
oListItem[“DeleteBy”] = User;
oListItem[“Location”] = Location;
oListItem.Update();
clientContext.ExecuteQuery();
}
}
}

/// <summary>
/// This method is a required placeholder, but is not used by app events.
/// </summary>
/// <param name=”properties”>Unused.</param>
public void ProcessOneWayEvent(SPRemoteEventProperties properties)
{
throw new NotImplementedException();
}

}
}

  •