Category Archives: SharePoint Online

Maps in PowerApps

This post outlines how to render address information on a map using PowerApps.  We will utilize SharePoint Online as the data source. However, keep in mind that you could opt for other (growing number of) sources, e.g.: Salesforce, Dynamics CRM Online, etc.

Quick Disclaimer –  At the time of writing this post, PowerApps is in Public Preview, so PowerApps’ features and accuracy of this post are subject to change.

Prep Work:

  1. Find a REST service to render your map. For this post, we’ll leverage Bing Maps:
    • Documentation and Requirements:
    • There are tons of options you could explore with Bings. To keep it simple and use plain address fields, let’s use this service:
      https://dev.virtualearth.net/REST/V1/Imagery/Map/Road/
      [YourAddressSpaceDelimited]?key=[YourBingMapKey]
    • Confirm your REST endpoint by going to the URL using a web browser
  2. Get the data source ready
    • Since SharePoint Online serves the underlying data for this example, I have created a plain-vanilla-custom-list, then added out-of-box address-related site columns.
    • Record the internal field names for all of your Address Fields

Steps in PowerApps Studio

  1. Open PowerApps Studio (currently available only for Windows 10 & 8.1)
  2. Create a New app and connect to your data source
  3. If you have connected to the data source correctly, some of your content should surface immediately
  4. Click on DetailScreen1 on left navigation pane, to display a single record view
  5. Click “Add a custom card” in the form design
  6. Select the Insert Tab then click on “Image”
  7. At this point, you should see the landscape icon in your Form.  If so, we will now construct our Bing Map onto this image.
  8. Go to the function (fx) text box to replace “SampleImage” with the REST Endpoint URL combined with the SharePoint internal field names, using the PowerApps Concatenate function.
  9. If you have done it correctly, the map should render almost instantly in Design mode.  A few additional notes:
    • Since this REST method separates the address with space, we are constructing a ” ” in our formula
    • PowerApps auto-populates field names in the function text box so you could easily confirm if you have the correct SharePoint internal field names

And there you have it! Hopefully straightforward.  Please leave comments with your thoughts and feedback.

Very much looking forward to the exciting things coming out of the labs of the MS Product Team and the magic our community creates out of this very promising product.

Advertisements

Easing the Pain of Document Copy in SharePoint

I was recently faced with a common challenge of needing to ship a document from one document library to another.  While we all wait for the upcoming, super promising Move & Copy feature (announced during Future of SharePoint), I had to come up with another route that doesn’t involve instructing the end users to use Save As or download a local copy then re-upload to the other library.

For this use case, the request was simple.  Copy a document to a different library.  For that reason, I immediately thought of an old trusted friend, the Send To destination.  Send To does everything that the end users needed, except the function is tucked away in the ribbon, accompanied by a teeny 16×16 icon.

 

This is, after all, a carry-over function from SharePoint 2007, so its lack of prominence is understandable.  In the spirit of making things easier though, I had to do a bit more digging.  As it turns out, the Send To function references a copy.aspx system file, residing in the _layouts folder.  What’s beautiful about this is the URL path, where you could identify the document location and send it anywhere within the web application (and yes, it does go across site collection!)

The formula is as follow:

[YourSourceSite]/_layouts/copy.aspx?SourceUrl=[YourDocument]&FldUrl=[YourTargetLibrary]&Source=[YourSourceLibrary]

As an example, here’s Demo Document being copied from Contoso Site to Demo Site:

http://contoso.com/_layouts/copy.aspx?SourceUrl=http://contoso.com/Shared%20Documents/Demo-Document.docx&FldUrl=http://contoso.com/sites/demo/Shared%20Documents&Source=http://contoso.com/Shared%20Documents

Now, what we can do with this information is to create a Custom Action (otherwise known as Quick Step) in SharePoint Designer (SPD) in order to promote this to our document’s Properties menu/hover card.  Once you connect to your site in SPD and find the Document Library, click on “New” in the “Custom Actions” section.

Give the Custom Action/Quick Step a name then select “Navigate to URL” option.  Copy the URL that you have constructed from the exercise above, except replace The Source URL (i.e.: the link to your document) with {ItemURL}

So the new formula is as follow:

[YourSourceSite]/_layouts/copy.aspx?SourceUrl={ItemUrl}&FldUrl=[YourTargetLibrary]&Source=[YourSourceLibrary]

Using our example, we would post this in SPD:

http://contoso.com/_layouts/copy.aspx?SourceUrl={ItemUrl}&FldUrl=http://contoso.com/sites/demo/Shared%20Documents&Source=http://contoso.com/Shared%20Documents

Once you save your Custom Action, you should see it immediately in the Properties menu/hover card.

Click the Quick Step/Custom Action and it will be like using the Send To.

A few things to note:

  • This process will copy document across libraries in different sites and different site collections (which is pretty cool)
  • It will copy metadata values *but* all columns and/or Content Types in the 2 document libraries must be identical.  Otherwise, you may run the risk of metadata values being left behind.
  • It can only copy 1 document at a time
  • It cannot copy Folder … but who wants to use folder anyways? =)
  • In my brief testing with the SharePoint Modern Library (i.e.: New Experience mode currently in SharePoint Online First Release, at the time this post was written), the Send To function does NOT work. The Copy page appears but clicking OK doesn’t actually do anything.
    That being said, this post would be less relevant after the new Move & Copy feature has been released for SharePoint 2016 and SharePoint Online (which should include move/copy function to other document libraries and OneDrive For Business)