Monday, July 17, 2017

DFFS v4.4.3.5 – hopefully sorted the custom js loading files issue

Thanks for the patience!

I have now released a new version with a few changes, and hopefully a final fix for the loading custom js files problem. See change log and additional help text in the Custom JS tab in DFFS.

In addition to the hopefully last fix on the load custom js files, I have made a a hopefully significant improvement on the load time in large forms. Please report back how the load time changes with this new version.

Post your findings below, or use the forum.

Best regards,
Alexander


by Alexander Bautz via SharePoint JavaScripts

Auth, Auth, Auth – The Bane of Our Development Existence

I was reading through one of Bob German’s (@Bob1German) recent (and great!) posts about Porting REST calls to SharePoint Framework and thinking about a conversation Bob, Julie (@jfj1997) and I had at our “salon”* when I was reminded of a very specific truth about our working days.

Image from New York City Department of Transportation on Flickr

I would venture to say that some ridiculously high percentage of all of our time developing with SharePoint and Office 365 comes down to figuring out why we can’t get something to work due to authorization or authentication issues. Some say this is a necessary evil to create enterprise software, but I say it’s an unnecessary problem. Unfortunately, documentation about auth stuff tends to be tremendously opaque and difficult to understand. In the same way that I expect the server to be there and I want nothing to do with it directly, I want auth stuff to just work – easily.

Sadly, this has never been the case with so-called “enterprise-class” software. On some level, I think the obtuseness of auth is there on purpose to keep the bar high enough to exclude lower end hackers. Unfortunately, we all get caught up in the kudzu of auth as a corollary effect.

Image from NatalieMaynor on Flickr

Ok, so that’s my editorial on auth. I wish it were easier, but it isn’t.

Recently in one of my Single Page Applications (SPAs) for a client, we kept getting weird failures in posting data to a list. Weird mainly in that I never saw the error on my end, my client is far away, and screen sharing is tricky due to the technical proficiency on that end. I’m not dissing anyone; they are great at what they do, but debugging JavaScript with me is not in their wheelhouse.

If you write software, you know that the worst bugs to squash are those that happen sporadically, and only on someone else’s machine – especially if you don’t have direct access to that machine. As usually, though, it was simply me doing something dumb with auth – which is not easy. Have I mentioned that?

Basically, the problem was that while I was fetching the request digest from the page (this is a “classic” page in SharePoint Online), I wasn’t ever refreshing the token. In this application, people move around from page to page enough and use the application for short enough time periods that we simply hadn’t seen the problem in testing.

Smart people will think “Marc’s an idiot” on this one, but I play the fool so you don’t have to.

The code comes from a service I use everywhere in my applications for this particular client. It’s basically a set of utility functions that are useful when you’re using Angular with SharePoint. I’ve built the SPA using AngularJS (1.x), so my code below represents that. However, similar logic can work with jQuery or whatever instead of AngularJS and $q. I adapted it from some Typescript code Julie was using, so credit there, with a bit of add on from me. I’ve added a bunch of comments and have also left some of the console logging I used in debugging – but commented out.

// Initialize with the token in the page in case there's a call that happens before we get a fresh token
self.requestDigest = document.getElementById("__REQUESTDIGEST").value; 

// This function makes a call to the contextinfo endpoint to fetch a new token
self.getRequestDigest = function (subsite) {

  var deferred = $q.defer();

  // This request must be a POST, but we don't need to send any data in the payload
  // i.e., it's a very simple call
  var request = {
    url: subsite + "/_api/contextinfo",
    method: "POST",
    data: '',
    headers: {
      'Content-Type': 'application/json',
      "Accept": "application/json;odata=nometadata"
    }
  };

  var success = function (response) {
    deferred.resolve(response.data)
  }

  var error = function (response) {
    deferred.reject(response.data);
  };

  $http(request).then(success, error);

  return deferred.promise;

}

// We call this function once when the page loads to set up the refresh looping
self.refreshRequestDigest = function (subsite) {

  // Set the default delay to 24 minutes in milliseconds
  var delayMilliseconds = 1440000;

  // Call the function above to get a new token
  self.getRequestDigest(subsite).then(function (contextInfo) {

    //        console.log(new Date() + " Old token:" + self.requestDigest);

    // Save the new token value in a variable available to all controllers using this service
    self.requestDigest = contextInfo.FormDigestValue;

    // Calculate the number of milliseconds which will be two minutes before the old token will expire
    delayMilliseconds = (contextInfo.FormDigestTimeoutSeconds * 1000) - 12000;

    //        console.log(new Date() + " New token:" + self.requestDigest);
    //        console.log("Waiting for " + delayMilliseconds + " ms");

    // Use setTimeout to set up the next token request
    setTimeout(function () {
      self.refreshRequestDigest(subsite);
    }, delayMilliseconds);

  });

};

// And here's the initial call to get things rolling. We need a token for the current site
self.refreshRequestDigest(_spPageContextInfo.webAbsoluteUrl);

The data we get back looks something like this:

{
  "FormDigestTimeoutSeconds": 1800,
  "FormDigestValue": "0xD22256967BAA39D5860CF0E812BE4AD0E018603851720D0E57581E1D1EBE8394865FF07EA3905DA1FE21D19D25BD6369B9D4F0F47725FBBB5AA7B3DE4EB54BAA,28 Jun 2017 15:21:52 -0000",
  "LibraryVersion": "16.0.6621.1204",
  "SiteFullUrl": "http://ift.tt/1H2SDM5",
  "SupportedSchemaVersions": [
    "14.0.0.0",
    "15.0.0.0"
  ],
  "WebFullUrl": "http://ift.tt/2v9ZG6t"
}

The thing we care about most is the

FormDigestValue
 , as that’s what we use to make our POSTs to SharePoint while it’s valid. But also note that there is an attribute in the returned JSON for
FormDigestTimeoutSeconds
. That’s the number of seconds that this particular token will be valid. In every tenant where I’m using the code, that works out to be 30 minutes. However, there may well be a setting which can change that, or Microsoft may change the time span on us. Because of this, I use the value to calculate how often to request a new token: T-2 minutes.

I’m pretty sure that there are pages in SharePoint which don’t do this correctly, so I’m not feeling like too much of an idiot. For example, when we click on an “app” – usually a list or library to you and me – in Site Contents, it opens in a new browser tab. Very often when I go back to that Site Contents page – when it has been sitting there for a while – I’ll get an unauthorized error. This may be fixed by now, though it has happened to me a lot.

I hope this is helpful. Using functions like this, we can make the whole auth thing easier on ourselves – and there zero reason to need to write this code from scratch every time. Store int in one place and if anything changes, you’ll have one place to fix it later.


  • We have occasional “software salons” – usually in one of our homes – where we simply get together to kick around what’s going on in our work lives, interesting things we’ve solved, etc. It’s a tremendously educational and useful exercise. I would encourage you to do something similarly informal if you don’t have enough water cooler time. At Sympraxis, we have no water cooler.

by Marc D Anderson via Marc D Anderson's Blog

Thursday, July 13, 2017

Datapolis Workflow 365 is now available in the Office 365 Store!

Community Blast Provided and Sponsored by Datapolis. This information was provided by vendor for community education on Datapolis Workflow 365

Datapolis (www.datapolis.com), a leading provider of business software announced today the launch of a new tool for creating and managing business processes in Office 365.

Datapolis Workflow 365

Datapolis Workflow 365 is a tool which enables the user to easily create advanced workflows in Office 365. The heart of the solution is a graphical workflow designer based on State workflow architecture, which provides a great environment for creating even the most complex workflows.

Datapolis Workflow 365

No programming knowledge is required to create Datapolis Workflow 365 workflows. Thanks to a clear graphical interface for building processes, the solution is understandable both for business users and IT Pro.

By separating the business logic from the rest of the process, the workflow diagram is very legible, making it easy to implement changes and optimize existing processes.

Datapolis Workflow 365

The unique feature of Datapolis Workflow 365 is the very intuitive user interface that is fully integrated with Office 365 interface so that participation in the process does not require any prior training.

“Datapolis Workflow 365 significantly enhances Office 365 business value as a collaborative environment. With the DW365, you can quickly and easily organize your document flow and tasks in an organization that uses Office 365 on everyday basis” – Pawel Bujak, CEO Datapolis

Trial of Datapolis Workflow 365 is available in the Microsoft Office Store: http://ift.tt/2t8oFK6

About Datapolis

Datapolis is the SharePoint workflow company with hundreds of customers across all continents serviced by a network of partners. Datapolis delivers innovative software which empowers organizations to automate business processes.

Please visit www.datapolis.com for more information.

Datapolis Workflow 365

The post Datapolis Workflow 365 is now available in the Office 365 Store! appeared first on Absolute SharePoint Blog by Vlad Catrinescu.


by Vlad Catrinescu via Absolute SharePoint Blog by Vlad Catrinescu

Teams vs Groups vs Everything Else

By now you should have had chance to see Microsoft Teams, Groups as well as everything else that makes up the Office 365 services and components. New applications seem to be released almost weekly, leaving you to figure out what should be used over something else.

read more


by via SharePoint Pro

Wednesday, July 12, 2017

Wherein In Profess My Love for Document Sets, My Hatred of the 5000 Item Limit, and Some Tips

I love Document Sets. There, I’ve said it. They help us solve so many important business needs, it’s crazy. Unfortunately, because telemetry tells Microsoft that not very many people use Document Sets, they haven’t gotten any love for a long time. On the other hand, I hate the 5000 item limit in lists and libraries because they prevent us from getting good work done for our end users.

With Document Sets, we essentially get folders on steroids. We have a canvas available to us in the form of the Welcome page, which is a Web Part Page we can customize to our heart’s content. That means we an add images, other Web Parts, script (using a CEWP or CSWP), whatever we need in order to make the Document Set sing for our users. We can even push specific metadata from the Document Set level down into the documents within it.

While on the one hand it’s great that Microsoft hasn’t given them any love for a long time (they haven’t broken anything), it will be great when they eventually get the “modern” sheen. (See my comment about not breaking anything – that’s key if the “modern” version is to get any use.)

Today’s episode comes courtesy of one of my clients where we’re using Document Sets to the max in SharePoint Online. It’s a life sciences R&D operation, and we’re tracking most of their significant research data in Document Sets, among other mechanisms. It’s a really cool project, and I often wish I could show more of what we’re doing.

When we first built one of the main libraries using Document Sets as the basis (with 14 different Content Type variants inheriting from Document Set and each other), we talked about how many items would ever be in the library. At the time, 5000 seemed like a huge and distant number. Even so, I added some indices to hedge against it, but clearly not enough indices. It’s been over two years using this system, and we’ve done a bunch of development on top that we couldn’t have predicted originally.

Recently, a couple of things stopped working the way they should. Even though we never expected to, we recently went over the 5000 item limit in the Document Library – 5099 is the current count. Here are summaries of the issues and how we fixed them. The ever wonderful and talented Julie Turner (@jfj1997) came to my rescue on some of it, as you’ll see.

Adjusting the Indices While Over 5000 Items

This has historically been a HUGE problem. Once you cross the 5000 item limit and actually NEED indices on some of your columns, you haven’t been able to create them. When you tried to do so, you’d get an error telling you that you had more than 5000 items, so you couldn’t add an index. Helpful. Off to Sharegate to move some content out, fix the indices,then Sharegate the content back in.

In our Document Set instances, we were getting some errors where we were making REST calls to retrieve items related to the current one. (The Document Sets connect together in pathways of experiments, and we store the ParentID for each item’s parent Document Set.) The REST call would only retrieve one item from the library, since there was a filter:

"&$filter=ParentID eq " + ID,

Unfortunately, ParentID wasn’t indexed, so we were getting 500 errors back from our REST calls. Sigh. I assumed I’d need to shuffle some content out to add the index.

Just on the off chance, I went to add the index anyway, even though we were over the 5000 item. Never hurts to try, right?

Miracle of miracles, I was able to add the index without SharePoint batting an eye. I haven’t had a chance to test this elsewhere, but in this tenant I was able to do what previously was impossible.

If this is indeed the new normal, our lives have indeed gotten a lot easier.

We can add indices to lists and libraries with over 5000 items!

In any case, it solved my immediate problem. Maybe I shouldn’t talk about it so loudly near the tenant in case it changes its mind.

Fixed the broken default view

No one – and I mean no one – likes to see this message on a SharePoint page:

This view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator.

 

To view items, try selecting another view or creating a new view. If you do not have sufficient permissions to create views for this list, ask your administrator to modify the view so that it conforms to the list view threshold.

We were seeing this horrible messaged in the List View Web Part at the bottom of the Welcome Pages. Since I have code running in the page, I wasn’t 100% sure that it wasn’t my fault.

Since the List View Web Part is only showing documents for this Document Set, it should only want to show a handful for each Document Set; nowhere near 5000. I was starting to think the Document Set was fundamentally broken by design.

Luckily, Julie was online and I asked her to take a look. She had the answer, and probably saved me hours trying to figure out why this was happening.

Her suggestion was to make sure the view doesn’t have “Show all items without folders” set to true. Sure enough, when I checked the view we were using for the Document Sets List View Web Parts, that was the setting. Julie pointed me to the article Manage large lists and libraries in SharePoint, specifically:

If you choose the Show all items without folders option in the Folders section when you create or modify a view in this list or library, you must then use a filter that is based on a simple index to ensure you don’t reach the List View Threshold.

Aha! For whatever reason over the years, we had set that very setting, and that was the problem. By turning that off, everything was right as rain again.

Document Sets Can Have Unique Views

This leads me to a little known thing about Document Sets: we can have a different view at the root of the library than inside the Document Sets. In fact, since you can inherit from Document Sets, you can have a different view per Document Set-based Content Type!

In fact, I was just reminded this yesterday from reading a post from Cameron Dwyer. Sure, it’s a setting on the Document Set settings page, but frankly, I’ve rarely noticed it.

The setting isn’t visible in the Document Set settings page when you create the Content Type, because you aren’t yet in the context of a list. Once you have enabled the Content Type on a list, you’ll see the additional settings.

Here’s the bottom of the Document Set settings in the Content Type definition:


and here’s the bottom of the page in a list context:

Note that the options are slightly different. In the list context we can choose a unique view for the Document Set-based Content Type. That means in my library, I could have 14 different views of the Document Set contents, one per Content Type, should I choose to do so.

Summary

Document sets are awesome. The 5000 item limit is not.

References


by Marc D Anderson via Marc D Anderson's Blog

Know issue with DFFS v4.4.3.3

There is unfortunately one issue with the latest version related to loading of custom js files and the custom js textarea.

If you have a rule triggering onload that calls on a function loaded in custom js, this rule will fail with an error message telling that the function isn’t defined.

The reason for this is that the loading of the require.js script that’s used for loading all other dependencies will defer the loading of custom js for a few milliseconds – enough for the rules to trigger.

I have tried to fix it, and a new version of the DFFS_frontend_min.js file can be downloaded here.

Please let me know if this fixes the issue, and I’ll wrap up a full package of files with this patch.

Sorry for the inconvenience,

Alexander


by Alexander Bautz via SharePoint JavaScripts

Tuesday, July 11, 2017

Collaborating beyond the firewall

Over the past few years, there has been a shift on organizations collaboration requirements. Initially, implementing SharePoint was an internal thing only, then over time it would turn into an Extranet or maybe a Public facing web site. For the work, I have done over the past 10 years, the decision to move in this direction was actually tied to business verticals.

read more


by via SharePoint Pro