Saturday, December 31, 2016

SPJS Charts for SharePoint v6.0.1 BETA 2

I have fixed the bugs reported in the previous BETA 1 version and updated to BETA 2. I believe most of the issues should be addressed now, but I need some more feedback to be certain it is ready for “production”.

You find the complete change log here, and please post questions and feedback in the forum.

Happy new year!

Alexander


by Alexander Bautz via SharePoint JavaScripts

Friday, December 30, 2016

Dear Microsoft: Please Fix Retrieving SharePoint Lookup Columns with REST When the Lookup List is in Another Web

I love SharePoint. I really do. I especially love writing client side code to build awesome applications for my clients.

Today’s annoyance, though, comes while I am in the process of rewriting an application I built on SharePoint 2007, porting it to SharePoint Online in Office 365. This ought to feel like a huge leap forward technologically, and in some ways it does. I’m changing all my SOAP calls with SPServices to REST calls. I’m switching from KnockoutJS to AngularJS, which will simply perform better given the profile of the applications. (KnockoutJS was the right choice years ago when I first built the applications, but the data and feature requirements have outgrown it.)

Unfortunately, I’m running into a simple constraint that makes my life a lot harder. When I first started building these applications five years ago, I created what I’ve got to say is a very solid information architecture. It’s withstood shifting needs and requirements in the interim, and I stand by it. One of the aspects of this good information architecture is storing commonly used reference lists in the root site of the Site Collection. By creating a Site Column which is a lookup into each reference list, I can reuse those common reference values throughout my subsites.

This works great in SharePoint 2007 with SOAP calls. When I retrieve items with one of these lookup Site Columns from a list in a subsite, I simply get the ID and Title values, separated by a “;#”. However, when I try to do the same thing with “modern” REST calls, I get an error like this:

{error":
  {"code":"-1, Microsoft.SharePoint.SPException","message":
    {"lang":"en-US","value":"The field 'Recommendation' is not supported in query. The lookup list is in another web."}
  }
}

I’ve been a good team player, and I’ve suggested they fix this on the SharePoint User Voice in my suggestion Enable support for lookup columns in other webs in the REST API. The votes are up, and it’s been a while.

There’s a workaround, but it’s not very pleasant. (The easiest workaround is to simply stick with SOAP calls and SPServices – I’ve done that in several cases in other projects. But SOAP is officially “deprecated”, so…)

Here’s a specific example. The client I’m working with is in financial services, and they issue recommendations on securities. Those recommendations are very standard, and predictable: Hold, Buy, Sell, etc. In other words, perfect to store in a list in the root site called Recommendations. Why not a Managed Metadata column, you might ask? Well, I also wanted to store several other columns in the Recommendations list, like Description (e.g., “The analyst expects the security to outperform their coverage universe.”), a SortOrder value so I could rearrange the values in dropdowns using SPArrangeChoices, and several other fields which drive configuration of some reports. In other words: great information architecture. The values are all consistent across the various subsites, I store them once, etc. Nice setup.

I created a Site Column back in the beginning called Recommendation, which is a lookup into the title column of the Recommendations list (Hold, Buy, Sell, etc.). I used that Site Column in many Content Types defined on the subsite level. Those Content Types are mainly used in a list I’ll call Notes.

In SOAP with SPServices, I can make this [simplified] call:

$().SPServices.SPGetListItemsJson({
  listName: "Credit Notes",
  CAMLViewFields: "<ViewFields>" +
    "<FieldRef Name='ID'/>" +
    "<FieldRef Name='Title'/>" +
    "<FieldRef Name='Recommendation'/>" +
    "</ViewFields>",
  CAMLRowLimit: 0,
  CAMLQueryOptions: "<QueryOptions>" +
    "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>" +
    "<IncludeAttachmentUrls>TRUE</IncludeAttachmentUrls>" +
    "</QueryOptions>",
  mapping: {
    ows_ID: { "mappedName": "ID", "objectType": "Counter" },
    ows_Title: { "mappedName": "Title", "objectType": "Text" },
    ows_Recommendation: { "mappedName": "Recommendation", "objectType": "Lookup" }
  }
});

This retrieves the items and returns nice JSON for me. Because Recommendation is a lookup column, it comes back as something like “1;#Buy” and that’s easy to turn into a JSON object like:

{ ID: 1, Title: "Buy" }

Easy, peasy.

However, when I try the analogous call in REST:

/_api/web/lists/getbytitle('Notes')/items?$select=ID,Title,Recommendation/Title&$expand=Recommendation

I get the error:

{error":
  {"code":"-1, Microsoft.SharePoint.SPException","message":
    {"lang":"en-US","value":"The field 'Recommendation' is not supported in query. The lookup list is in another web."}
  }
}

In other words, there’s no way to $expand the Recommendation column because it comes from an other Web, even though that is ideal information architecture!

The workaround, which André Lage (@aaclage) pointed out in my UserVoice suggestion (but I clearly didn’t get at the time), is to simply ask for the Recommendation column’s ID instead. This isn’t obvious at all:

[siteCollectionSubSiteUrl]/_api/web/lists/getbytitle('Notes')/items?$select=ID,Title,RecommendationId

This doesn’t follow the syntax we’d expect: we need to append “Id” to the end of the lookup column’s InternalName. Of course, this just gets us the ID of the item in the Recommendations list; it doesn’t fetch us the Title value, which is what we really want. Because of this, I need to do a *separate* REST call to get the items from the Recommendations list and merge the values in my client side code.

[siteCollectionRootSiteUrl]/_api/web/lists/getbytitle('Recommendations')/items?$select=ID,Title

Now, one could argue that this is more efficient. I don’t ask the server to $expand the values across thousands of notes (yes, there are way more than 5000; I’ve written enough about that lately – I may have mentioned it here and here and here and here), so it gets a break. Retrieving the 5-10 values in the reference list (in this case) is no big deal.

But I have a half dozen or so of these lookup columns to deal with in this application, which means a half dozen extra REST calls, plus the code to merge the values. More work for me, but more importantly a longer wait for the application user when they load the page. I believe that poor UX is what has doomed many a SharePoint roll out, and I loathe creating a poor UX myself. In this case, I’ll make it work, but I’d really like to see this change.


by Marc D Anderson via Marc D Anderson's Blog

Tuesday, December 27, 2016

Upgrading to SharePoint 2016

So, that time has come, SharePoint 2016 has been around for a while now, stood the test of time over the past few months and now you want to upgrade. Well where do you start?

That depends on what version you are upgrading from, 2003, 2007, 2010, 2013 or something else. Depending on the source will depend on the approach. However, understanding the options and what can and can’t be done is important for any upgrade.

So, let’s look at some of the reasons to upgrade, apart from the obvious which would be because it is new and shiny.

read more


by via SharePoint Pro

Sunday, December 18, 2016

DFFS v4.4.2.2 released

I have published a new revision of DFFS and plugins. You find the full change log here: http://ift.tt/1AglZXU

Please post any comments or questions in the forum.

Best regards,
Alexander


by Alexander Bautz via SharePoint JavaScripts

Tuesday, December 13, 2016

SHAREPOINT COMMUNITY NEWSLETTER - The holidays are coming!

Hi everyone,

The holidays are coming and the Geese are getting fat (and so will I be with all the fun and food of the season). If you are celebrating this time of the year then ....HAPPY HOLIDAYS... from all of us here :)

So what do we have in store for this week's Newsletter?

We've been really busy getting phase 1 of the brand new community ready, so keep reading to find out how to access 500+ hours of SharePoint and O365 Videos!

The Ultimate Business Decision Maker’s Guide to Hybrid SharePoint - Nick Brattoli

Check out this amazing article from Nick Brattoli, who gives a great insight into everything you need to think about when deciding if SharePoint Hybrid is something you should consider. The article also covers the main issues you should think about if you are considering to go 100% on-premises or fully into Office 365. - Read More..

[SPONSORED LINK] - **NOW Available** Deploying SharePoint 2016: Best Practices for Installing, Configuring, and Maintaining SharePoint Server 2016

Are you a SharePoint Admin that wants to learn how to properly deploy SharePoint 2016? In this book, SharePoint MVPs Vlad Catrinescu and Trevor Seward will teach you how to install and configure SharePoint 2016 in depth, and how to optimize your environment based on real world best practices. Readers will benefit from the most stable and performance driven SharePoint 2016 environments possible. Order the eBook or your hardcover copy today!

Collab365.Community - This month's most popular Videos!

We are moving ever closer to the full migration of the SharePoint Community site over into the new Collab365 Community site, and expect to fully migrate in January next year. In the meantime, we wanted to share with you some of the fantastic content that is already in place on the new site with this month's most popular videos:

1) ** Laura Rogers ** covers the creation of flows in Office 365, with integrations and specific examples of translating business process from Designer to Microsoft Flow - Here

2) ** Bill Ayers ** brings us - Git, Gulp, Grunt, Node and Code: Making Sense of the Modern SharePoint and Office 365 Development Toolkit. A fantastic title to this great session which will get you up to speed on the modern development toolkit. -Here

3) ** Richard Harbridge ** and the The Top 10 Ways To Improve Office 365 & SharePoint Adoption. Richard shares industry leading real world experience, advice and activities that other customers are leveraging to get more from O365 and drive meaningful adoption. - Here

4) ** Mark Kashman ** with SharePoint and OneDrive – reinventing content collaboration. . Mark shares mobile-first and cloud-first updates for SharePoint and OneDrive. Loads of news and demos. Take a look -Here

Are you looking for great SharePoint Intranet Templates?

Are you looking for great SharePoint Intranet Solutions ('Intranet In a Box') either for on-premises or online?...turnkey solutions for Microsoft SharePoint 2010, 2013, 2016 and online?. The Intranet templates listed here offer a range of features including company news, mobile access, multi-lingual, forms, people directory, social collaboration and much more. Take a look - Here

Where to find the Best Office 365 and SharePoint Admin Tools?

IT Administrators will find the best tools here to help with SharePoint, Azure, Office 365 and Exchange and SQL Administration. - Find out more

** Save 40% on Microsoft Press books! **

Just in time for Christmas, save 40% on some amazing Microsoft eBooks! Pssst. Hurry though, as this offer ends December 31, 2016.  - Redeem Here

That's all for this week folks, hope you enjoy all that fantastic content. Watch this space for the community migration updates as we get the community fully up and running on the new Collab365 Community site early in the New Year.


by Fraser Beadle via Everyone's Blog Posts - SharePoint Community

Monday, December 12, 2016

SPJS Charts for SharePoint v6.0.1 BETA 1

SPJS Charts for SharePoint v6.0.1 BETA 1

  • Updated the filter methods to add cascading filters. See instructions in the “Custom CAML and filter” tab in the chart config, or the user manual.
  • Fixed a bug where “Show item count below chart” could not be turned off.
  • Fixed a bug with inserting charts in a WIKI page. The charts would be added, but was invisible when editing the page. I had to make the insertion of the charts a bit more manual in WIKI pages, so you must copy  a snippet from the “Add new chart” dialog, and embed it in the WIKI page using “Embed code”. If you need to remove an “invisible” chart added in a WIKI from previous version append “?contents=1” to the URL, and remove the charts from this view.
  • Fixed a bug with using “Consume filter from list view web part” in SharePoint 2013.
  • Added back the “Show filter info below chart” option after it got lost in the update to v5.

This is currently in BETA, and you find the files here. Please post any issues of feedback in the forum.


by Alexander Bautz via SharePoint JavaScripts

Developing a Mobile Application for SharePoint

You are sitting in a meeting at work, and someone says “wouldn’t it be great if we could have a mobile application that would allow our users to complete X within SharePoint?” or was it the one where someone says “we need a SharePoint Mobile App for our site?”. If this is something that has been discussed with your organization, then I feel your pain as you try to understand why we would build mobile apps that talk to SharePoint.

read more


by via SharePoint Pro

Thursday, December 1, 2016

Getting the instance id of a running Azure Function with ExecutionContext.InvocationId

Getting the instance id of a running Azure Function with ExecutionContext.InvocationId

Recently I had a discussion about Azure Functions, the pros and cons, and running multiple instances of batch processing simultaneously.

One of the immediate questions that came up in that discussion was; In the built-in logs you see in the streaming log service or in the log console, how do you know which message comes from what invocation?

Great question, let's dig into that!

Get the Invocation Id of an instance of a Azure Function

When a Function runs, it gets a new unique identifier by default. You can see this in the invocation log:

2016-12-01T22:34:34.605 Function started (Id=6844c578-b2e5-4449-bdde-cee0273106ae)  
... 
... 
... 
2016-12-01T22:34:34.699 Function completed (Success, Id=6844c578-b2e5-4449-bdde-cee0273106ae)  

There's a guid there, which is the ID of the current instance of the function. But what if you want to use that Id in all your log messages or anywhere else you need it?

Introducing the ExecutionContext

While digging around in the Azure WebJobs SDK, I found the ExecutionContext object:

GitHub: Azure WebJobs SDK Extensions - ExecutionContext.cs

This file is very simple and has a single job. Getting the invocation id.

In your Azure Function, you can add this to your parameters like this:

public static void Run(string input, ExecutionContext exCtx, TraceWriter log)  
{
    ... your logic here...
}

Now, you can use exCtx.InvocationId from wherever you want in this method, and you'll get that unique identifier.

Here's a quick example of this in action, to distinguish multiple running functions' log messges in a stream of logs.

using System;

private static string _invocationId;  
private static TraceWriter _logger;

public static void Run(string input, ExecutionContext exCtx, TraceWriter log)  
{
    // Assign the ExecutionContext to a variable we can access later
    _invocationId = exCtx.InvocationId.ToString();

    // Assign the Log to a variable we can access later
    _logger = log;


    Log("Hello World");
    Log("This is a sample");
    Log("I hope it works!");

}

// Using this Log method instead of the log.Info message, appends the invocation id every time. (for demo purposes..)
private static void Log(string message){  
    _logger.Info($"Function-({_invocationId}): {message}");
}

Getting the instance id of a running Azure Function with ExecutionContext.InvocationId

Should you now run multiple instances of this function, you could distinguish the log messages from a big chunk of data and filter it easily. But that's just a demo use-case; If you need the Function invocation id for something, that's how you get it.

Cheers,
Tobias.


by Tobias Zimmergren via Zimmergren's thoughts on tech

Reuse your C# Script (csx) code in multiple Azure Functions

Reuse your C# Script (csx) code in multiple Azure Functions

Azure Functions hit GA (General Availability) recently. A big milestone for the Azure Functions team, and I'm happy to see that it's finally out of Preview.

Lately I've been working a lot with various parts of Azure to find the best fit for various busines cases. Functions has been one of those adventures, doing a lot of R&D around how they can be put to good use. One of the pitfalls I found early on was that I wanted to have multiple functions process different things on the same "task". With that I also had various helper methods I wanted to load in each function, but I didn't want to re-write them in each and every one of them.

With that said, this post is simply about how you can load the same code in multiple functions without having to re-invent yourself. Think of a shared C# script (csx) file as a user control or component you'd inject.

Sharing code between Azure Functions

For the sake of the sample, I've created new functions which are without the read business logic, as that would clutter the samples. As such, the samples here illustrate how you can share code between your Azure Functions only.

Create a folder for your reusable code

There's various ways to go ahead and create this shared folder. If you're developing using the CLI and file system you can do it there, or if you're developing using the browser you can easily do it from Kudu etc.

I'll show you how to creat the shared file using Kudu.

Navigate to your Azure Function app service Kudu Debug Console, which is prefixed with your function name, like this:

http://ift.tt/2gEWWXu  

Next, navigate to \home\site\wwwroot which should list your functions and the host.json file etc. Click the [+]-sign and create a new folder:

Reuse your C# Script (csx) code in multiple Azure Functions

I'm creating a folder called Shared since this is what we see as a practice from the Azure team as well. In there, I'm creating my CustomerHelper.csx file which will contain the reusable code snippets I need.

CustomerHelper.csx content

In the new file, I've added some basic sample code to illustrate the idea.

using System;

public static class CustomerHelper  
{
    public static CustomerInformation GetCustomerData(string customerId)
    {
        // NOTE: For demo purposes only...

        // Return a new CustomerInformation object, which is also in this shared file.
        return new CustomerInformation{
            CustomerName = "Sample Customer 1", 
            CustomerId = "customerid-12345", 
            CustomerAddress = "Home Sweet Home", 
            IsRecurringCustomer = true
        };
    }
}

// CustomerInformation object, in the shared file so we can access it from any function.
public class CustomerInformation  
{
    public string CustomerName { get;set; }
    public string CustomerId { get; set; }
    public string CustomerAddress { get; set; }
    public bool IsRecurringCustomer {get;set; }
}

Referencing your shared code from your Azure Functions

Great. We have a shared code snippet in our CustomerHelper.csx now, containing a simple method for getting customer details and it returns a strongly typed CustomerInformation object.

This is what one of my Azure Functions look like, simply referencing the code in the shared code file:

#load "../Shared/CustomerHelper.csx"

using System;

public static void Run(string input, TraceWriter log)  
{
    log.Info("Getting customer info...");

    var customerInfo = CustomerHelper.GetCustomerData(input);

    log.Info("==== CUSTOMER INFO ====");
    log.Info($"Customer Id: {customerInfo.CustomerId}");
    log.Info($"Customer Name: {customerInfo.CustomerName}");
    log.Info($"Customer Address: {customerInfo.CustomerAddress}");
    log.Info($"Returning Customer?: {customerInfo.IsRecurringCustomer}");
    log.Info("=======================");
}

You use the #load statement to point to your code that you want to import into this file.

Read more on C# Script and the #load statement: http://ift.tt/2gEUNvg

Running this function will show your the information in the log, as per the snippet:

2016-12-01T23:05:50.014 Function started (Id=c8f41956-b2dc-4a8c-833e-1ec341d859eb)  
2016-12-01T23:05:50.014 Getting customer info...  
2016-12-01T23:05:50.014 ==== CUSTOMER INFO ====  
2016-12-01T23:05:50.014 Customer Id: customerid-12345  
2016-12-01T23:05:50.014 Customer Name: Sample Customer 1  
2016-12-01T23:05:50.014 Customer Address: Home Sweet Home  
2016-12-01T23:05:50.014 Returning Customer?: True  
2016-12-01T23:05:50.014 =======================  
2016-12-01T23:05:50.014 Function completed (Success, Id=c8f41956-b2dc-4a8c-833e-1ec341d859eb)  

Reuse your C# Script (csx) code in multiple Azure Functions

Done! That's all there's to it. I hope it helps.

Cheers,Tobias.


by Tobias Zimmergren via Zimmergren's thoughts on tech

Pluralsight Black Friday Deal – Save $100 (33%) and invest in a brighter you.

The Pluralsight Black Friday offer has been extended until December 2nd! With Black Friday and Cyber Monday,  every company put out out some crazy deals out there for this special occasion! Luckily, Pluralsight which is one of the best online on-demand training providers is also having a super deal, allowing new and existing customers to get a 1 Year Subscription at only 199$ USD , so 100$ or 33% off!

Pluralsight Black Friday

This is a great investment to keep your skills up to date and to learn new ones! Check out the promo on the Pluralsight Website, or by clicking the big image above.  If you’re interested in learning cool stuff about Office 365 and SharePoint 2016, click on the below banners to see my latest courses on those subject! Click on the banners to go to the course page!

Planning for SharePoint Server 2016: Physical Topology and Services

SharePoint Server 2016 brings a lot of changes to the Infrastructure Architecture, with new features such as MinRole and Microsoft Identity Manager. You’ll learn how to plan your SharePoint 2016 Infrastructure to answer your business needs.

Planning for SharePoint Server 2016: Logical Architecture and Integrations

This course will teach you how to plan your SharePoint 2016 logical architecture, SharePoint farm security, and how to plan for integration with Exchange Server 2016 and Project Server 2016.

Implementing a Hybrid SharePoint 2013/2016 Infrastructure

SharePoint hybrid infrastructures are gaining popularity, so SharePoint IT professionals need to prepare. You’ll learn how to configure a hybrid infrastructure in either SharePoint 2013 or SharePoint 2016 to allow your users to be more productive.

PowerShell for Office 365

Take your Office 365 Administrator skills further by learning to automate repetitive tasks as well as access advanced settings using the magic of PowerShell.


by Vlad Catrinescu via Everyone's Blog Posts - SharePoint Community