SharePoint Online Articles / Blogs / Perficient https://blogs.perficient.com/tag/sharepoint-online/ Expert Digital Insights Tue, 03 May 2022 14:05:29 +0000 en-US hourly 1 https://blogs.perficient.com/files/favicon-194x194-1-150x150.png SharePoint Online Articles / Blogs / Perficient https://blogs.perficient.com/tag/sharepoint-online/ 32 32 30508587 Associate a hub site to another hub site in SharePoint Online https://blogs.perficient.com/2021/10/19/associate-a-hub-site-to-another-hub-site-in-sharepoint-online/ https://blogs.perficient.com/2021/10/19/associate-a-hub-site-to-another-hub-site-in-sharepoint-online/#respond Tue, 19 Oct 2021 21:02:16 +0000 https://blogs.perficient.com/?p=299199

Last month, Microsoft launched a new feature: associate a hub site to another hub site.

This functionality will add the ability to associate a SharePoint hub site to another hub site to expand search results across multiple hubs in your organization. This will enable users to discover relevant content when searching on any sites related to the associated hubs. In this post, we will look at how to associate a hub site to another hub site.

When this will happen:

This feature is currently in preview and may not be available in your tenant.

Targeted Release Customers – End of September 2021

All Customers – End of October 2021

What changes you will see:

When you associate hubs, there are no visual changes to the user experience except for when users search for content. Below please find a table for better comparison between Associated child hub site and Associated child site.

(Note: These two sites are using communication site template)

  (Associated child hub site)

 

(Associated child site)

 

Permissions Does not change the permissions

(can sync hub permissions)

Does not change the permissions

(can sync hub permissions)

Theme Can change the Theme Can’t change the Theme, it is set to automatically adopt the same theme from Parent hub site
Logo Can change the logo Can change the logo
Header Can change the Header image Can change the Header image
Hub Navigation Hub Navigation doesn’t show up Hub Navigation shows up
Search scope The site becomes part of the Parent hub site Search Scope The site becomes part of the Parent hub site Search Scope
News and activity rollup Content doesn’t roll up to the Parent hub site Content rolls up to the Parent hub site
Highlighted Content web part (Documents) Content doesn’t roll up to the Parent hub site Content rolls up to the Parent hub site
Events web part Content doesn’t roll up to the Parent hub site Content rolls up to the Parent hub site

How to associate a hub to another hub:

You can run a PowerShell command to associate a hub site with a Parent hub site.

(Note: This feature is currently in preview and may not be available in your tenant.)

Before running a PowerShell command, you will need to know HubSiteId for both Parent hub site and Associated child hub site

  • Run this command to get the HubSiteId for Associated child hub site:
            Get-SPOHubSite -Identity <AssociatedChildHubSiteURL>

               Bp1

  • Run this command to get the HubSiteId for Parent hub site:
            Get-SPOHubSite -Identity <ParentHubSiteURL>

               Bp2

  • Run this command to establish hub to hub association
Add-SPOHubToHubAssociation -Source <Associated child HubSiteId> -Target <Parent HubSiteId>

      Bp3

Please see Microsoft Documentation to learn more about this PowerShell command.

Please see Microsoft Documentation which explains this functionality in more detail and also shows how to achieve this from SharePoint Admin Center.

]]>
https://blogs.perficient.com/2021/10/19/associate-a-hub-site-to-another-hub-site-in-sharepoint-online/feed/ 0 299199
What is SharePoint app bar https://blogs.perficient.com/2021/05/19/what-is-sharepoint-app-bar/ https://blogs.perficient.com/2021/05/19/what-is-sharepoint-app-bar/#comments Wed, 19 May 2021 07:44:08 +0000 https://blogs.perficient.com/?p=292368

The SharePoint app bar is a little flyout on the left-hand side of all modern SharePoint sites, which looks like this.

Appbar

SharePoint app bar aims to help users find important content and resources no matter where they are in SharePoint.

You can enable Global Navigation to allow users to easily navigate to your company’s navigation from anywhere in SharePoint. Global Navigation is the only tab that you can customize on the SharePoint app bar. My sites, My news, and My files tabs will update your personalized content on SharePoint.

Global Navigation

Sites

News

Files

Globalnavigation Sites1 News1 Files1


Facts about SharePoint app bar

  • When Global Navigation is not configured, the home icon links to the SharePoint start page.
  • You cannot disable specific tabs on the app bar.
  • You cannot disable the SharePoint app bar for specific sites
  • SharePoint app bar will show up even if you have a vanity URL (mysharepoint.contoso.com) for your SharePoint tenant
  • If you have more than one Web Apps under your tenant, the app bar will show up only for the root Web App. SharePoint app bar will not show up for non-root Web Apps
  • The app bar is not available for classic sites as of right now. However, SharePoint Admins can add it to classic sites manually
  • Personalized content in the SharePoint app bar is enabled by Microsoft Graph

SharePoint app bar Availability
Microsoft hasn’t provided any specific date, but recently it has reached “general availability” (GA) status. Microsoft is pushing it out tenant by tenant so you will know soon when it will hit your tenant. 

Temporarily disable the SharePoint app bar.
You can temporarily disable the app bar in your tenant to prepare for this change or control its rollout to users. The tool that disables the app bar will be available until October 31, 2021.

  1. Run this PowerShell command
    Set-SPOTemporarilyDisableAppBar $true

  2. To check the app bar status by running this command
    Get-SPOTemporarilyDisableAppBar

It can take up to an hour for the app bar to be removed on a tenant where the app bar is already showing up.

Enable SharePoint app bar
Once you are ready to display the app bar, you can run this PowerShell command.

Set-SPOTemporarilyDisableAppBar $false

Customize Global Navigation

  1. Make sure you are SharePoint Admin to follow these steps
  2. Navigate to your organization’s home site (Read this blog post if you have not set up a home site for your organization)
  3. Select Settings and then select Global navigation settings
    Settings
  4. Switch Enable global navigation to On
    Gn1
  5. If you want, you can add the customized logo for Global Navigation, as shown below. This logo replaces the default home icon in the app bar. Logo size: Height: 20px Width: 20px Logo file type: PNG (Transparent background recommended) 
    Gn2 

  6. Enter a title that will be displayed at the top of the Global Navigation. Usually, this can be your company’s name.

            Title

     7. Select the Navigation source as needed and click on the Save button.

          Ns

Navigation source can be changed at any time by SharePoint Admins. After performing these steps, it may take up to 24 hours for the changes to take effect.

How to determine which Navigation source to use for Global Navigation
For home sites that are a hub, you can select “Homesite navigation.”
For home sites that are not a hub, you can select “Hub or global navigation” and edit global navigation as needed.

]]>
https://blogs.perficient.com/2021/05/19/what-is-sharepoint-app-bar/feed/ 2 292368
New Add to OneDrive feature coming to a tenant near you! https://blogs.perficient.com/2020/07/15/new-add-to-onedrive-feature-coming-to-a-tenant-near-you/ https://blogs.perficient.com/2020/07/15/new-add-to-onedrive-feature-coming-to-a-tenant-near-you/#respond Wed, 15 Jul 2020 10:30:42 +0000 https://blogs.perficient.com/?p=277329

With the latest announcement of the Add to OneDrive feature rolling out for public preview, this will carry over into SharePoint and Teams to give you the same look and feel as within OneDrive. Today we’ll quickly highlight what the “Add to OneDrive” feature is and how you can start using it!

What is the Add to OneDrive feature?

In its simplest form, the “Add to OneDrive” feature is used to add shared folders directly to your OneDrive. “What are shared folders” you may ask? Well, shared folders include any type of content that others have shared with you through their OneDrive as well as content that is part of your shared library in SharePoint or Teams. So if someone shares a folder (whether it be in OneDrive, SharePoint, or Teams) you will have the option to “Add shortcut to My files” which will create a shortcut to the shared folder in your OneDrive so you can easily find and work with the file(s). Microsoft is adding this feature in an effort to help you bring all of your shared content into one place, without stripping away any type of existing security or compliance policies in place.

Where can I find this “Add shortcut to My files” option?

As mentioned, this is rolling out as a Public Preview now but what I haven’t mentioned is that this feature will be released worldwide by the end of September 2020!

How do I use this new feature?

Using in OneDrive

Once the public preview has rolled out to your tenant you will see this option by following these steps:

  1. In OneDrive, in the navigation bar on the left-hand side, select Shared > Shared with me
  2. Find the folder that you want to add, and click the little circle icon in the folder’s tile to select that particular folder.
  3. Select Add shortcut to My files OR right-click the folder, and then select Add shortcut to My files

Screenshot of selecting a file and then selecting Add shortcut to My files.

Image provided by Microsoft

Using in SharePoint/Teams

If you want to use this feature in a shared library within SharePoint or Teams, you can select Add shortcut to My files to add the shortcut to the entire library, or even select a specific folder that you want to add and then select Add shortcut to My files.

Screenshot of adding a shortcut to your OneDrive from a shared library

Image provided by Microsoft

Caveats with Add to OneDrive feature

There are a few caveats we should mention. You won’t see the Add shortcut to My files option in these scenarios:

  1. You already added the folder to your OneDrive, or you have selected more than one folder (sorry you can’t do multiple folders at once).
  2. You are trying to add a file instead of a folder. The Add shortcut to My files only works on a folder level, not an individual file level or collections of files (i.e. albums)
  3. You already have a shortcut in place for SharePoint that you are syncing. In this case, the folder you are syncing will stay where it is in File Explorer and you won’t have the Add shortcut to My files option available. This is currently a limitation of Public Preview and is being addressed by Microsoft, so this should be fixed upon its release for general availability in September.

That about wraps up this quick update on the new Add to OneDrive feature. I hope you have found this blog helpful and I encourage you to check back regularly for exciting news around all things Microsoft 365!

]]>
https://blogs.perficient.com/2020/07/15/new-add-to-onedrive-feature-coming-to-a-tenant-near-you/feed/ 0 277329
Provision a SharePoint library with SPFx extensions https://blogs.perficient.com/2019/06/19/provision-a-sharepoint-library-with-spfx-extensions/ https://blogs.perficient.com/2019/06/19/provision-a-sharepoint-library-with-spfx-extensions/#respond Thu, 20 Jun 2019 01:56:13 +0000 https://blogs.perficient.com/?p=240986

Overview
This series will show you how to create a SharePoint library while provisioning SharePoint Framework extensions. The step by step screenshots is provided in each section.

Introduction
The SharePoint Framework (SPFx) is a page and web part model that provides full support for client-side SharePoint development, easy integration with SharePoint data, and support for open source tooling.
Here is the link to help you familiar with it.
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-framework-overview

Steps:
Create a SharePoint Framework extension.
1.1 Create a new extension by running the Yeoman SharePoint Generator yo @microsoft/SharePoint
1.2 Fill the related information for the project
1.3 Install the related dependencies (npm install)
For more details:
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api

Create a SharePoint library which you need.

Export the schema.xml for the library with the following link.
$SiteUrl/_vti_bin/owssvr.dll?Cmd=ExportList&List={$libraryId}

Go to library settings, then you can see the library ID.

Update the schema.xml
4.1 Remove all of the Name={xxx} attribute

4.2 Add two attributes (SetupPath=”pages\viewpage.aspx” WebPartZoneID=”Main”) to View.

4.3 Add two attributes (SetupPath=”pages\ form.aspx” WebPartZoneID=”Main”) to View.

4.4 Remove the redundant path(TestLibrary/Forms/) of View and Form Url attribute.

Update your extension project.

5.1 Update package-solution.json file

5.2 Update elements.xml file

Add ListInstance

You can find the feature id and template type in the schema.xml file.

5.3 Add the updated schema.xml to sharepoint/assets folder

For more details:
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/toolchain/provision-sharepoint-assets

Deploy extension to SharePoint App Catalog.
6.1 Build and package your solution by followed commands
gulp bundle –production
gulp package-solution –production
6.2 Upload the packaged file to App catalog and publish it.

Install the extension to your site. The library will be created when the app installed.

Summary
Briefly speaking, if you want to provision other SharePoint contents with the schema.xml file, you also can use the same way to achieve it.

Reference
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/toolchain/provision-sharepoint-assets
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api
https://docs.microsoft.com/en-us/sharepoint/dev/spfx/sharepoint-framework-overview

]]>
https://blogs.perficient.com/2019/06/19/provision-a-sharepoint-library-with-spfx-extensions/feed/ 0 240986
How to Create an Approval Flow using Microsoft Flow https://blogs.perficient.com/2019/06/10/how-to-create-an-approval-flow-using-microsoft-flow/ https://blogs.perficient.com/2019/06/10/how-to-create-an-approval-flow-using-microsoft-flow/#respond Tue, 11 Jun 2019 02:18:07 +0000 https://blogs.perficient.com/?p=240808

This solution will show you how to create an approval flow using Microsoft Flow.

Below is the structure of the flow:

  1. Add the “SharePoint – When an item is created” trigger.

  1. Add the “Send an email notification” action to remind the user that the submission is successful.

  1. Add the “Initialize variable” action. This action is used for getting the approvers from a specified SharePoint group. In this example, we are using “Approver Group”.

  1. Add the “Send an HTTP request to SharePoint” action and use the REST API to get the approvers from the SharePoint group. The full text in the Uri field should read: /_api/web/sitegroups/getbyname(‘Approver Group’)/users. And rename it to “GetApproversGroup”, we will use it in step 5.

  1. There are two specific steps to append the email of each of the approvers to the “emailList”. Firstly, add the “Apply to each” action and fill the field value with: body(‘GetApproversGroup’)[‘d’][‘results’]. And rename it to “ForEachApprover”, we will use it in the next step.

  • Secondly, add the “Append to string variable” action inside it. The full text in the value field should read: items(‘ForEachApprover’)[‘Email’]

  1. Add the “Start and wait for an approval” action and select “Approve/Reject – First to respond” for approval type. Configure it to send the approval to the approvers. Here is an example.

  1. Add a “Condition” to handle the response from the approval, we can configure it to send different emails to the submitter.

Now, whenever an item is created in the SharePoint list, your flow will be triggered and send the email to the submitter and approval request to the approvers.

 

Summary

Microsoft Flow is easy to you and your organization to create an automated approval flow without SharePoint workflow using the SharePoint designer.

Reference:

https://docs.microsoft.com/en-us/flow/all-assigned-must-approve

 

]]>
https://blogs.perficient.com/2019/06/10/how-to-create-an-approval-flow-using-microsoft-flow/feed/ 0 240808
Core Components of Microsoft Teams – Part 4 – SPO & ODfB https://blogs.perficient.com/2019/03/21/core-components-of-microsoft-teams-part-4-spo-odfb/ https://blogs.perficient.com/2019/03/21/core-components-of-microsoft-teams-part-4-spo-odfb/#respond Thu, 21 Mar 2019 18:26:14 +0000 https://blogs.perficient.com/?p=237670

Hello and welcome back to part 4 of the “Core Components of Microsoft Teams” blog series! Last time we discussed Office 365 Groups and how they are leveraged by Microsoft Teams. In a similar fashion, today we’ll be covering how SharePoint Online and One Drive for Business tie into Microsoft Teams. This will be a tad longer than the previous blog articles so buckle up!

How Teams Uses SharePoint Online & OneDrive for Business

In Teams, anytime that a user shares a file this will be stored in SharePoint Online and OneDrive for Business. As you may remember in the last blog article, upon the creation of a team an underlying O365 group will be created. In addition, when that team is created you will also automatically provision a SharePoint Team site as part of that O365 group.

Note: If you were to create a team with the same name as a preexisting team, then the SharePoint URL will include a GUID. Best practice is to adhere to Microsoft’s O365 group naming policies to ensure this does not happen.

Another piece we can add to the mix is OneNote which is provisioned with the O365 group. The team OneNote will be stored within SharePoint Online. In addition, we can add tabs for any:

  • SharePoint page
  • SharePoint list
  • News section
  • Single document from document library

Lastly you also have the ability to add a connector for news articles from SharePoint to post within Teams. This will give you the ability to bring the collaborative aspects to the forefront for this hub for teamwork. Now that we’ve covered how Teams will use SPO and ODfB, let’s discuss the advantages of storing files in SPO and ODfB in Microsoft Teams.

Advantages

One thing that many people take for granted is the ability to co-author or use online versions of Office applications. This is immensely helpful especially when you have multiple users trying to work on one document simultaneously. Another huge advantage is the ability to leverage governance and compliance features. These data governance and compliance features are already built into both SPO and ODfB and include:

Another advantage is the mobile experience offered for Microsoft Teams, SharePoint, and Office apps for both Android and iOS. Current day, you also have the ability to preview up to 270+ file types which allows you to continue to work within Teams without having to jump out of Teams and into a new application in order to view the file. In addition, since the files are being stored inside of OneDrive and SharePoint this means they will be accessible by Delve and SharePoint search, both of which will respect the corresponding file permissions that are set. As you may already know, you will also have an OneDrive sync client to synchronize any of the files that are established for the team. This is available to both Windows and Mac users. Lastly, a key advantage of storing files in OneDrive and SharePoint Online involves respecting of SharePoint and OneDrive for Business settings and locations. This will help determine how we leverage both products within Microsoft Teams. Now that we’ve covered the advantages of storing files in SPO and ODfB, let’s discuss the real purpose behind integrating files into Microsoft Teams.

File Integration in Teams

Files are an integral part in the Teams client. However, depending on where the file is placed, will determine where the file will be stored (SharePoint Online vs OneDrive for Business). For example, any file that is uploaded/placed inside of a channel will be stored in the SharePoint Online site associated with the team’s O365 Group. However, if a file is shared in a chat then these files will be stored in the sender’s OneDrive for Business. In addition, while in the “files” tab you will have the open to “Open in SharePoint” which will allow you to utilize features like the sync button (as seen below).

Although OneDrive for Business and SharePoint Online are the primary cloud storage applications that Microsoft recommends, you do have the option of adding in additional cloud storage providers within any channel. Some of the options include:

  • Dropbox
  • Box
  • ShareFile
  • Google Drive
  • Additional SharePoint Online Library

Note: You cannot substitute OneDrive for Business or SharePoint Online as the native file experience within Microsoft Teams.

File Structure

Now let’s talk a little about the structure of each file within Teams for both applications (ODfB and SPO).

SharePoint

From a SharePoint perspective the following steps will take place:

  1. Team is created
  2. Corresponding O365 group created
  3. Corresponding modern team site created
  4. Document library created (which contains folders for each channel)

Note #1: The first folder with any newly created team will be called “General”. As additional channels are added into a team, each corresponding folder will be created inside of the document library.

Note #2: By default, all channels and folders will inherit permissions of the O365 Group. However, since this is a SharePoint document library you will have the ability to leverage all administrative tools available in SharePoint Online. Any changes made to the underlying permissions will be reflected within Microsoft Teams as well. 

OneDrive for Business

From an OneDrive for Business perspective the following steps will take place:

  1. File shared in one-to-one or one-to-multi person chat(s)
  2. File uploaded to the OneDrive of user wanting to share file
  3. Share file out
  4. Set unique permissions as they see fit based on person/people in chat

So now that we see what SharePoint Online and OneDrive for Business bring to the table, let’s see what our experience would be like without the two products integrated in Microsoft Teams.

Life without SharePoint Online or OneDrive for Business

As you may guess, your experience with Teams will be lacking many key features if SharePoint Online and OneDrive for Business are not utilized. SharePoint Online itself is a prerequisite for OneDrive for Business and without one or the other you cannot:

  • Store and share files in channels
  • Perform private file sharing
  • Access the team SharePoint site

If you are starting to think that without these two integrations your experience would be very lackluster, then you are entirely correct! In addition, this can cause confusion for your end users when it comes time for them to access a file or share a file. Many times when users get an error message stating they don’t have the ability to share a file or access a file they immediately assume something is broken. So the best practice is of course to leverage SharePoint Online and OneDrive for Business in your environment to ensure an optimal end user experience and to be able to leverage all that Teams has to offer. Now that we know how files are structured as well as the potential impact of not having SPO or ODfB can present, let’s outline where you should configure certain settings present in both Teams and Groups in SharePoint.

When adding members
  • In Teams
    • Takes effect in Group and Teams
  • In Group/SharePoint
    • Takes effect in Group and Teams
When promoting members to owners
  • In Teams
    • Takes effect in Group and Teams
  • In Group/SharePoint
    • Takes effect in Group and Teams
When changing channel/folder name
  • In Teams
    • Changes channel name but keep folder name
  • In Group/SharePoint
    • Changes folder name but will break Teams integration
When changing file permissions for members
  • In Teams
    • File permissions can’t be configured in Teams, but will respect permissions set in SharePoint
  • In Group/SharePoint
    • Takes effect in Group and Teams

This wraps up everything we will discuss in today’s blog article. Tune in for the last blog article on Exchange and how this ties in to Microsoft Teams in the next blog!

 

]]>
https://blogs.perficient.com/2019/03/21/core-components-of-microsoft-teams-part-4-spo-odfb/feed/ 0 237670
SharePoint Online Timer Jobs with Azure functions Using PnP – Part 2 https://blogs.perficient.com/2019/02/01/sharepoint-online-timer-jobs-with-azure-functions-using-pnp-p2/ https://blogs.perficient.com/2019/02/01/sharepoint-online-timer-jobs-with-azure-functions-using-pnp-p2/#respond Fri, 01 Feb 2019 09:10:50 +0000 https://blogs.perficient.com/?p=235501

Overview

This post is the second part of the blog about creating SharePoint timer job with CSOM PnP code, using Azure Functions. In this part, you will see how to create the Azure Function and Connect to SharePoint Online with Application Credentials.

The source code of the demo project is available at the following location. https://gitlab.com/public-code-peng/demoazurefunctiontimerjob You can use it to smoke test all your Azure Function settings.

High-level steps:

  1. Create Azure AD Application Registration (Part 1)
  2. Create Azure Resource Group and Function App (Part 2)
  3. Connect to SharePoint Online with Application Credentials (Part 2)

Create Azure Resource Group and Function App

The Resource Group (Demo-TimerJobs) must be created first before deployment happens so that a Function App can be created inside of it.

Create Azure Resource Group

Step 1. Navigate to Resource groups, then click the Add button.

Step 2. Provide the Resource Group value Demo-TimerJobs and select the Subscription with Pay-As-You-Go, then click Create button.

Create Function App

The function App is created inside of the Resource Group.

Step 1. Navigate to the Demo-TimerJobs resource group, click on “Add” button.

Step 2. Search for Function App, then click on the Create button.

Step 3.  Provide the App Name DemoAzureFunctionTimerJob, select the Resource Group (Demo-TimerJobs) in previous steps, select Hosting Plan with Consumption Plan and make sure Runtime Stack is.Net, then click Create button.

Step 4. Search for the “DemoAzureFunctionTimerJob” Azure function in the Function Apps, select SSL under Platform features tab.

Step 5. Select Private Certificates (.pfx), then select the Upload Certificate and upload the Demo.pfx file created in previous steps.

Step 6.     Click on the Upload button. The Demo certificate will show as the following screenshot.

Step 7. Navigate to Function App settings change runtime version to ~1

Connect to SharePoint Online with Application Credentials

After the above steps are done, it is time to create an Azure Function solution in Visual Studio 2017. In this article, we will create a demo application that connects to SharePoint Online and count number of documents in Document library. The purpose of this application is to show you how to connect to SharePoint online with Application credentials.

Step 1. Create an Azure Function solution in Visual Studio 2017. (Make sure you have Azure Functions and Web Jobs Tools selected when installing Visual Studio 2017)

Select Azure Functions v1 (.NET Framework) and Timer trigger.

Step 2. Install SharePointPnPCoreOnline package with NuGet Package Manager.

Step 3. Rename the default Function1.cs file to DemoAzureFunctionTimerJob and update its code as following:

The source code of this demo is available at https://gitlab.com/public-code-peng/demoazurefunctiontimerjob

Please check the details of the ContextProvider.cs file to understand how we get the client context with the Application credentials.

Note: The timer job schedule is configured at the first line of the Azure Function with TimerTrigger. The Azure Function is using CRON expressions for setting up the schedule. In our demo application, it means every 5 minutes, the Azure function will be executed.

The RunOnStartup option is enabled for debugging. There is no need to wait for the timer trigger.

For more information about the CRON expressions, please read the following article from Armin Reiter.

https://codehollow.com/2017/02/azure-functions-time-trigger-cron-cheat-sheet/

Deploy Function App via Visual Studio

In this article, we will publish the DemoAzureFunctionTimerJob with Visual Studio 2017.  If you plan to deploy it with the Azure DevOps, please read article Azure function Continuous Deployment with Azure DevOps. The deployment with Visual Studio 2017 is pretty straight forward, right click on the Azure Function project and then click on Publish button.

Select “Select Existing” and “Run from package file”, then click on Publish button

Find the “DemoAzureFunctionTimerJob”, then click OK button. The Azure function is deployed to Azure now.

Update Application Settings

In the demo code, we used the following environment variables:

App Setting Name

Description
AADClientId The Azure AD Application ID
AADTenantId The Tenant ID
AADCertificateThumbprint The Certificate Thumbprint which retrieved when execute .\Get-SelfSignedCertificateInformation.ps1
WEBSITE_LOAD_CERTIFICATES Same as AADCertificateThumbprint
WebUrl The SharePoint Online Web URL

ListTitle

The Documents library title

These environment variables are stored in Application Settings.

Navigate to the Application settings page, add new settings as following:

Make sure the “WEBSITE_LOAD_CERTIFICATES” is set to the Certificate Thumbprint value which retrieved when executing.\Get-SelfSignedCertificateInformation.ps1.

Execute the timer job

Finally, we are ready to execute the timer job. Navigate to the function and click on the Run button.

The following screenshot shows the log window after executing the timer job. It shows in my SharePoint Online Documents library, there only 1 document in it.

In case you need to debug the Azure function, it is pretty straight forward. All you need to do is open the “Cloud Explorer” (Not the server explorer), find the Azure function and Attach Debugger to it.

]]>
https://blogs.perficient.com/2019/02/01/sharepoint-online-timer-jobs-with-azure-functions-using-pnp-p2/feed/ 0 235501
SharePoint Online Timer Jobs with Azure functions Using PnP – Part 1 https://blogs.perficient.com/2019/02/01/sharepoint-online-timer-jobs-with-azure-functions-using-pnp-p1/ https://blogs.perficient.com/2019/02/01/sharepoint-online-timer-jobs-with-azure-functions-using-pnp-p1/#comments Fri, 01 Feb 2019 07:32:29 +0000 https://blogs.perficient.com/?p=235461

Overview

This series will show you how to create SharePoint timer job with CSOM PnP code, using Azure Functions. The step by step screenshots is provided in each section. It will give you a jump start if you are new to Azure Functions and want to create timer jobs with Client Side Object Model.

Introduction

An Azure function is a new option for building SharePoint Online timer job. Comparing to Azure Web Jobs, it will do the job just fine for the light-weight and short running pieces of code, which is very often the case with timer jobs. It also supports Pay-As-You-Go (Consumption plan) which makes it much cheaper to maintain a Timer job. Here is the list of Pros of using Azure function vs. Azure Web Jobs.

  • Pay-As-You-Go (Consumption plan)
  • Automatic scaling (CPU and Memory is scaled according to the demands at runtime)
  • More triggers
  • In-browser development

There is more comparison between Azure function and Azure Web jobs than the above short list. Here is the link to help you choose between Azure Functions and Azure Web Jobs. https://stackoverflow.com/questions/36610952/azure-webjobs-vs-azure-functions-how-to-choose

This article will show you how to build a timer job using Azure functions and SharePoint PnP CSOM extension. If you don’t have tons of legacy code that were built upon PnP, please ignore this article and start searching for more relevant options since Azure function is not limited to C# or PnP.  Here is the full list of Azure Functions supported languages https://docs.microsoft.com/en-us/azure/azure-functions/supported-languages

This post is divided into two parts, the first part is about creating Azure AD Application Registration. If you are familiar with it, you can skip it and start with the second part which about creates the Azure Function and Connect to SharePoint Online with Application Credentials

High-level steps:

  1. Create Azure AD Application Registration (Part 1)
  2. Create Azure Resource Group and Function App (Part 2)
  3. Connect to SharePoint Online with Application Credentials (Part 2)

Create Azure AD Application Registration

The first step is to register a new Azure AD Application. This will give the Azure Function App only permissions and context for the SharePoint Online tenant to run against. It is required for Azure Function to authenticate with SharePoint Online. If you are not familiar with Azure AD Applications, please check the following link for detailed step by step guidance.

https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread

The steps described below are just the screenshot with a brief explanation.

1.Log into Azure Portal – Azure Active Directory – App Registrations, click on “New application registration” button which is highlighted in the following screenshot.

https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps

2.Provide a Name (DemoAzureFunctionTimerJob) for the application, selection option Web app / API, and fill in the Sign-on URL with a URL ( e.g. https://www.pnp.com. Click on the Create button to create the Azure AD application.

Copy the Application value and save it in a note pad.

3.Click on Settings link, then Required permissions, and select Add button.

4.In the new blade Add API access, select Office 365 SharePoint Online

5.Select required permission for your app. In this article, the DemoAzureFunctionTimerJob app will only need the “Read and write items and lists in all site collections” permission. Click Select and Done buttons to save permissions.

6.Select the Grant Permissions button. (A lot of people missed this step)

7.Run the script in the DemoAzureFunctionTimerJob project in the Tools folder with this command:

.\Create-SelfSignedCertificate.ps1 -CommonName “Demo” -StartDate 2019-01-21 -EndDate 2050-01-21 -Password (ConvertTo-SecureString -String “MyPassword” -AsPlainText -Force)

8.Run the script in the Tools solution with this command:

.\Get-SelfSignedCertificateInformation.ps1 -CertPath <path to cert>

9.Select the Manifest button at the top of the blade, then select Edit.

10.Find the keyCredentials property and replace it with the snippet generated with the .\Get-SelfSignedCertificateInformation.ps1

Before:

After:

When replacing the keyCredntials value with the keyCredenitals snippet, it will underline the value property in Red, to fix this, make sure value is all on 1 line.

11.Click Save button to save the Manifest.

12.Navigate to the URL below with the information from your App Registration, populate <client id> with the Application Id from the App Registration:

https://login.microsoftonline.com/<tenant>.onmicrosoft.com/adminconsent?client_id=<clientId>&state=12345

The page will redirect to the www.pnp.com which doesn’t exist. This is expected, please just ignore.

]]>
https://blogs.perficient.com/2019/02/01/sharepoint-online-timer-jobs-with-azure-functions-using-pnp-p1/feed/ 1 235461
Store PowerApp Camera Photos in SharePoint or OneDrive https://blogs.perficient.com/2018/10/08/store-powerapp-camera-photos-in-sharepoint-or-onedrive/ https://blogs.perficient.com/2018/10/08/store-powerapp-camera-photos-in-sharepoint-or-onedrive/#respond Mon, 08 Oct 2018 20:11:59 +0000 https://blogs.perficient.com/?p=227972

In order to capture a Photo taken from a PowerApp, we are going to take advantage of the Camera control to capture an image and pass that to a Flow which will save it to SharePoint on OneDrive. The process relies on the workflow expression Base64ToBinary() which we will call within the Flow to convert the image format received from PowerApps (base64) into the correct format to store in SharePoint or OneDrive (binary). Let’s get started.

Setup the Storage Location

As mentioned above OneDrive and SharePoint both have a Create File action that can be used and are pretty interchangeable. Using the use-case of a receipt up-loader I’m going to use SharePoint for this demo. We’ll just create a simple Library called “Receipts”.

SharePoint Library (no custom fields)

Library created to store receipts. The out-of-the-box fields will suffice.

Create the Flow

Next we will create the Flow that will handle the conversion. This Flow will get triggered from the PowerApp and will take a few different arguments needed to store the document.

NOTE: once you start requesting properties it is hard to undo with a PowerApps Trigger. It is best to get all your actions created first, see what you need, and then start asking for properties in the order that you would prefer.

Initial Steps

  1. Create a Flow from blank, and for the trigger use the PowerApps trigger from the PowerApps connector. We will later be able to trigger this within the App as a function call.
  2. The next step will be to convert the file data we get from the PowerApp into a usable object that Flow can handle. This is the Compose action that is apart of the “Data Operations” connector. For now, leave the Inputs property blank and we will come back to this in a moment.

    Data Operations Compose Action – Used to create objects

  3. The third step is to select the Create File action for the respective platform you would like to use. Once you have selected your action, You can now ask for the File Name and the File Content properties.

    You can request any type of field be provided by the PowerApp

  4. After asking for both properties, You will see that they become available to use in the tool panel.

    Pass the File Content Argument to the Compose action.

     

Base64ToBinary Magic

In order to store the image, we need to convert to binary so that the Create File action can properly store the file. this is where the Base64ToBinary() Workflow function comes in to play.

  1. First in the Expression panel, enter the function and have the cursor within the the parenthesis

    The function also provides intellisense for the parameters needed

  2. Then switch to the dynamic content panel and select the FileContent property we asked for earlier. the expression should read:
    base64ToBinary(triggerBody()['name of file content variable'])
    NOTE: If you followed the instructions exactly, the name of the content property should be “CreateFile_FileContent”.
    Once you fill in the function (see screenshot below) press “OK”.

    example of the formula in the tool panel before clicking “Ok”.

Final Flow

If you’ve followed the steps above your Flow should look similar to the screenshot below. Once it looks good, save, and we’re done with the Flow.

Make sure the Input for the Compose function has the “Fx” symbol and the “base64ToBinar…” text

IMPORTANT NOTE: Once you save and exit, if you come back into the flow, the Compose Inputs field might reset itself to be just the FileContent property. You will have to reset this to use the base64 function otherwise it will break when you save it again.

Build the PowerApp

Now with calling the function from the PowerApp, we’ll keep it as simple as possible. Create from a blank template (tablet or mobile is fine) and on the page we’ll add a camera control. I’ve expanded the camera control to cover the whole mobile screen (besides for a header) to make it easy for the user to click. I’ve also added a label at the bottom of the screen to let user’s know to press the camera to take the photo.

NOTE: it is important to use the OnSelect event handler on the Camera control itself because otherwise the photo will not be correctly captured.

We don’t want the user to just automatically load the image without review, so we are going to create a User Experience so that the user can review the image first. To do this, we set the camera control’s OnSelect handler to: ClearCollect(receiptPhoto,Camera1.Photo);UpdateContext({receiptTaken:true})

This will store the camera’s photo in a collection called “receiptPhoto“, and also update a variable called “receiptTaken” to true. This variable controls the visibility of a second set of objects grouped together to display a copy of the image captured. Once this is true, a few components are used to display the preview.

Preview Panel Experience

In order to allow the user to review their photo, we are going to insert five components and group them. We will then need to configure their visibility property to be dynamic based on the variable receiptTaken. This will support the user being able to take a picture and then preview the image and have the chance to re-take it if not acceptable.

  1. Icons > Box – A box to cover the other content to focus the preview panel (think of a shadow behind a modal)
    1. note – 
  2. Media > Image – An image component that is set to display the preview image. The image property will be set to: First(receiptPhoto).Url
  3. Text > Label – A label to present the generated file name. This can be generated a number of ways, but to keep it simple we set the Text property to:
    "Receipt-"&Text(Today(),"[$-en-US]mm_dd_yyyy")&".png"
  4. Text > Label – A second label to display the content string (this is the string version of the string in base64. This isn’t required but is useful for testing). We set the Text property to:
    First(receiptPhoto).Url
  5. Controls > Button – A “retake” button to rehide the preview panel and allow the user to retake a photo. The Onselect handler is:
    UpdateContext({receiptTaken:false})
  6. Controls > Button – And finally the “Save to SharePoint button”. This button has a hefty function configured for it’s Onselect handler in place so let’s break it down more.

Using the Flow function to Save the Image

Now that we have built our Flow to do the Document conversion and storage, we can go back to the PowerApp to hook up the flow to our original submit button. In the PowerApps editor, under the Action tab select Flows. This will pull up a panel where you can see all your Flows with triggers set to PowerApps. Select the Save to SharePoint button, and then in the panel select the Flow you created earlier. By selecting the button first it will auto apply the Flow call to the OnSelect event handler. Depending on the order you setup your properties to ask for from PowerApps, your intellisense might be different, but the content property is the most important part to set:

General Formula:

ReceiptUploader.Run("Receipt-"&Text(Today(),"[$-en-US]mm_dd_yyyy")&".png", Substitute(First(receiptPhoto).Url,"data:image/png;base64,","")); Notify("Your receipt was saved",NotificationType.Success);Navigate(DetailScreen1,ScreenTransition.Fade)

FileContent_FileName Property

same as the label – "Receipt-"&Text(Today(),"[$-en-US]mm_dd_yyyy")&".png"

FileContent_FileContent: Property

Here we use the substitute function to remove the prefixed encoding details:

Substitute(First(receiptPhoto).Url,"data:image/png;base64,","")

At the end of the function, we set a simple notification to appear and navigate the user to another screen. We will end it here but another thing to handle would be a user navigating to this page should have the navigation function also update the receiptTaken variable to false to make sure the preview panel isn’t still displaying.

Make sure to save and publish your PowerApp. You are now ready for testing!

Ready for Testing

With the app saved, you can now go through testing the app. (my screenshots are prefixed with “134” instead of “Receipt”).

My ceiling (before the photo)

Preview panel of my ceiling

Once I hit “Save Receipt”, I get the Notification across the top of the screen.

And finally in SharePoint you should see your receipt.

And we’re Done! Now with the basis built, this can be expanded to be integrated with any use-case (receipt uploader, Field Workers, etc.). The reference to this file could be stored in a separate tracking list from the Flow or the experience for the PowerApp could be to generate the name of the receipt based on other fields. PowerApps can’t read from document libraries yet but

]]>
https://blogs.perficient.com/2018/10/08/store-powerapp-camera-photos-in-sharepoint-or-onedrive/feed/ 0 227972
Send a Flow Approval to a SharePoint Group’s Members https://blogs.perficient.com/2018/09/20/send-a-flow-approval-to-a-sharepoint-groups-members/ https://blogs.perficient.com/2018/09/20/send-a-flow-approval-to-a-sharepoint-groups-members/#comments Thu, 20 Sep 2018 05:09:22 +0000 https://blogs.perficient.com/?p=231450

Out of the box Microsoft Flow does not currently support getting the members of a SharePoint group. This makes it difficult to utilize existing groups that outdated SharePoint Designer Workflows would use. This leaves two options for a flow creator, A) create a custom list to track approvers, or B) set static emails in the approval Flow itself. By using SharePoint groups instead, we can allow an end user to update this in the future, without having to touch the Flow.

Thankfully with the SharePoint API action available in Flow, we now have the ability to query SharePoint groups. This will return an array of objects containing the users information including the email.

Initial Flow Configuration

To properly configure the approval action we need to first initialize a string variable.

With the variable initialized, we can now call the HTTP Request action to pull the groups members.

Once you select the site, you can configure the Uri to call the group rest API (See Microsoft documentation for more details). If the name of the group can potentially change, you can also use the ID of the group instead by using the syntax: http://<site url>/_api/web/sitegroups(<group id>)/users

After the URI it is also important (and required) that you set the accept and content-type header properties to “application/json;odata=verbose”.

Iterate over the Response

The next step will be to now iterate over the results of this call. The response object that is returned will be in the following format:

{"d":{
"results":[{
"__metadata":{
"id":"http:///_api/Web/GetUserById(16)",
"uri":"http:///_api/Web/GetUserById(16)",
"type":"SP.User"
},
"Groups":{"__deferred":{"uri":"http:///_api/Web/GetUserById(16)/Groups"}},
"Id":16,
"IsHiddenInUI":false,
"LoginName":"i:0#.w|domain\\user1",
"Title":" User1 Display Name ",
"PrincipalType":1,
"Email":"user1@company.com",
"IsSiteAdmin":false,{
"__metadata":{
"type":"SP.UserIdInfo"},
"NameId":"s-0-0-00-000000-0000000000-0000000000-000000",
"NameIdIssuer":"issuer id"
}}, ...]
}}

Flow cannot auto detect the properties returned so we will need to manually enter the values using Workflow Expressions (see workflow definition documentation). In order to iterate over the results, create a for each loop and pass in the value body(‘name of HTTP Action in Flow‘)[‘d’][‘results’].

This will get us into the results array and allow us to reference the different properties (i.e. Email) of each member. Within the For Each loop, we will then create an Append to String Variable” Action.

Again since we do not have the properties auto populated, we will need to use workflow expressions. The value here follows the format items(name of For Each Loop’)[‘Email’].

NOTE: make sure to add a semi-colon after the email. This can either be done with expressions (using the concat function) or can simply just be added after the value (see screenshot above).

Once we are done iterating through the list, we can now configure the Approval action. This can be configured as needed, just make sure to set the Assigned to field to the emailList variable.

Once the approval is configured, you will just need to configure how to handle the approval response with a condition. Feel free to reach out (or leave a comment) if you have any questions.

]]>
https://blogs.perficient.com/2018/09/20/send-a-flow-approval-to-a-sharepoint-groups-members/feed/ 3 231450
Customizing Your SharePoint Form with PowerApps is Live https://blogs.perficient.com/2017/11/21/customizing-your-sharepoint-form-with-powerapps-is-live/ https://blogs.perficient.com/2017/11/21/customizing-your-sharepoint-form-with-powerapps-is-live/#respond Tue, 21 Nov 2017 19:56:06 +0000 https://blogs.perficient.com/microsoft/?p=36971

What We’ve All Been Waiting For.

Following the team’s Q3 update, it was only a matter of time before they turned on the power for a long awaited piece of functionality. Unfortunately, it’s only rolling out to first release tenants, but that shouldn’t stop people from starting to get their hands on it. After Ankit posted last Wednesday about updates going live, I jumped on my own tenant and started getting my hands into it.
Though not yet fully released, I’m pleased to announce it looks great, and works seamlessly within the SharePoint layout. For those that have done modern SharePoint development, It’s similar to the property pane of the SharePoint Framework (SPFX).
I’ve laid out a basic guide for how you can begin customizing your forms. The screenshots below show just how easy it is.

Customize your Forms with PowerApps


Using the modern experience, I’ve created a new list with some simple fields added for demo sake. I’ll go ahead and select PowerApps > Customize Forms, which is where the new hook is. This will take you to PowerApps online.

PowerApps – Editing the Template Form

PowerApps will setup a basic form for you to start from. You’ll notice that the look is a little different from a normal PowerApp. If you are not familiar with this view, you will notice on the left an outline view of the components you have on your form. You can access the form fields from here, as well as their sub-components such as the input box, label, etc.
Though the design looks a little different than the normal PowerApp style, all the standard customizations are still available. Here, I’ll focus on automatically calculating the Title field and setting a default value for the Request Date field. This can be handled with some simple changes to the form field properties which we will get into next.

Unlock your Form Fields

In order to access some of the inner parts of the form fields, you have to “unlock” the field. Select a field that you would like to edit either from the left-hand navigation or by clicking on it, then on the right under the “Advanced” section, unlock the title field and the requestDate fields.

NOTE: unlocking these properties can cause different behaviors that one might not expect if not familiar. Microsoft has a great guide on the form control for reviewing these properties if you would like to learn more before diving in.

Changing the Defaults

The two changes we’ll make will be dependent on each other and I’ll explain why inline.

  1. Request Date – We will set this field’s default to today’s date. By having the property unlocked, we can now change the DefaultDate property to the function Today(). This can either be accessed from the formula bar above, or the property pane on the right.
  2. Calculated Title – Instead of requireing users to manually fill in the title, let’s auto-calculate the field from the selected field values. I’ve selected the Title field and have set it to the following:
    "Request for: "&User().FullName&" ("&DataCardValue3.SelectedDate&")"

     
    Using some simple concatenation, this allows me to access the current user’s full name and the requestedDate value.

Saving and Publishing to SharePoint

Saving and publishing to SharePoint is as easy as ever. Go to File > Save, and after saving you’ll see the publish option appear. Select that and you are all set! You can now go back to your list and go to the new form. You will see it now embeds nicely into a side-pane for the list. No longer do you have to use a page viewer web part to recreate this functionality—the  platform handles it automatically.

and the final list form display

What’s Next?

Hopefully this guide is helpful for any individual interested in reviewing this long awaited functionality. Following this post, look forward to more details coming out about how you can make the PowerApps custom form work for you and how integrating with Flow can continue to handle ever-growing use-cases.

]]>
https://blogs.perficient.com/2017/11/21/customizing-your-sharepoint-form-with-powerapps-is-live/feed/ 0 225332
Getting Access Tokens for both SharePoint and Microsoft Graph https://blogs.perficient.com/2016/08/19/getting-access-tokens-for-both-sharepoint-and-microsoft-graph/ https://blogs.perficient.com/2016/08/19/getting-access-tokens-for-both-sharepoint-and-microsoft-graph/#comments Fri, 19 Aug 2016 08:32:38 +0000 http://blogs.perficient.com/microsoft/?p=33387

A few days ago, I was working on a project and needed to know if it was possible to access a user’s Exchange Online calendar using the same access token used to access list data in one of their SharePoint Online site collections. The Microsoft documentation is confusing due to the rapid pace of change with this stuff.
At the time I remember thinking that it seems like we are not quite at the “one token to rule them all” nirvana yet, since the Microsoft Graph API does not yet support getting data out of SharePoint lists or I would just use Microsoft Graph for both the SharePoint Online and Exchange Online (Outlook) data.  Everything I was seeing made it look like I was going to have to make the user authenticate with Azure AD twice, once for each resource in order to get an access token for the requested resource.  Yikes, that would be a horrible user experience!
But finally I figured it out. You can actually get an access token for a different resource by using the original refresh token!  This is means you don’t have to make the user authenticate twice :).
You have to call the AuthenticationContext.AcquireTokenByRefreshTokenAsync method and pass in the original refresh token and the name of the new resource you need the token for, and you will get an access token back!
In my case, I first got an access token (and refresh token) for a SharePoint Online site, and then I used that refresh token to get an access token for the Microsoft Graph resource (https://graph.microsoft.com).
This was not documented anywhere on MSDN, I had to get a cached copy of a Bing search result to find this out. Here is the link that I used:
http://cc.bingj.com/cache.aspx?q=office+365+multiple+resource+refresh+token+&d=4979548031156742&mkt=en-US&setlang=en-US&w=oIxeh7gpcqjYb7B7Ipalkzv9FeNsgn_p
Crazy…

]]>
https://blogs.perficient.com/2016/08/19/getting-access-tokens-for-both-sharepoint-and-microsoft-graph/feed/ 2 225171