in

Dot Net Mafia

Group site for developer blogs dealing with (usually) Ionic, .NET, SharePoint, Office 365, Mobile Development, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for Ionic, SharePoint, and Office 365.
  • Hands on with OneDrice File-On-Demand for Mac

    Today, Microsoft released the long waited Files-On-Demand support in macOS Mojave. As you might know Files-On-Demand (or FOD) has been available in Windows 10 for a while but it has been a featured that we have been waiting for in macOS for quite some time. Now at Ignite, Microsoft is giving you the opportunity to try it out. In order to try it out, you first have to upgrade to macOS Mojave 10.14. The latest version of macOS just came out today on September 24th and is now available to download. If you are running on a beta version still, you can try it out as well.

    The second thing, you need to do is make sure you are in the Insiders Ring for Office and / or OneDrive. If you aren’t sure, download the script from the installation site. It’s a bash script, so you will need to make the script executable. If you aren’t familiar with this process, you have to get back to the Unix / BSD roots of OS X. Open a new Terminal, and go to the directory where you downloaded the script and then execute the following command:

    chmod u+x ./EnableMacFilesOnDemand.sh

    Screen Shot 2018-09-24 at 1.32.24 PM

    If you’ve had OneDrive installed on your Mac before, you’ll need to delete some cache files in the following folder: ~/Library/Caches/OneDrive. Delete *.json in that folder.  I didn't actually do this step, but you may need to.

    Now you can install the OneDrive client. Download the client from the install link and then go through the install process. Launch OneDrive when it’s complete. If you run into issues, there are a few troubleshooting tips about force closing Finder. I didn’t have to do that but you may need to on your machine.

    If you have enabled the new macOS Mojave Dark Mode, the first thing you might notice is that the OneDrive client respects that and will also show using Dark Mode. Good job, OneDrive engineering team! That makes for a nice experience.

    Screen Shot 2018-09-24 at 1.40.33 PM

    I had to setup one of my Office 365 accounts on this particular machine but that’s good because it gave me an idea for the new account setup experience. After you sign in, you’ll get this new dialog that explains the icons that you will see in Finder.  Cloud = online only, checkbox = the file is on disk.  This is helpful, because I’ve always had trouble remembering what the icons mean in FOD for Windows 10.

    Screen Shot 2018-09-24 at 1.11.55 PM

    For existing accounts, you may need to turn on Files-On-Demand manually. I didn’t have to in my case, but it’s good to know where to go. Go to Preferences in OneDrive and then look for the Files-On-Demand section. You can see verify whether it has been turned on or not.

    Screen Shot 2018-09-24 at 2.27.40 PM

    Now we can go find our OneDrive folder inside Finder and see how it all works. When I open one of my synced folders, you’ll notice that I am now seeing files that I have not downloaded yet indicated by the cloud icon next to each one. That’s right, I am seeing files that are online, but not yet downloaded.

    Screen Shot 2018-09-24 at 1.45.20 PM

    Clicking on an online file will immediately download it and you can access it like you had it all along. This is what we have been waiting for. If you right click on a file, you now see the option to Always keep on this device. This is how you tell OneDrive to keep that file on your device for offline use.

     Screen Shot 2018-09-24 at 1.43.28 PM

    Once you do that, you’ll notice the icon changes from a cloud to a check mark.

    Screen Shot 2018-09-24 at 1.44.10 PM

    I’m looking forward to using this on a day-to-day basis. This should make working with OneDrive files online and offline much easier with macOS Mojave 10.14.

  • SPFx Basics: How to create a page anchor

    With React, sometimes the simplest of things are overly complicated.  When it comes to creating a page anchor so your users can jump down to a specific point in the page, this one is no exception.  From our old HTML4 days, you probably remember you create an anchor by doing something like the following:

     <a name="my-anchor-name"></a>

    When you look for the name attribute of an anchor in React though, it's nowhere to be found.  Ultimately this has to do with React's routing system, but that doesn't really do you any good in your SPFx Web Part.  How do you get around it?  One way is to use the Link component from Fabric React.  You'll notice it does have a name attribute but using it isn't quite straight forward.  First, include Link on the page you are building.

    import { Link } from 'office-ui-fabric-react/lib/Link';

    Once you do that, add your Link to the page using the name attribute and a unique identifier.  This will be the destination we are jumping to.

    <Link name={'my-uniqud-id'} href={'#'}></Link>

    You might be wondering why I have the href tag there on the anchor tag.  That is because the Link element renders a Link element as a button instead of an anchor tag if there isn't an href tag.  You can include any value you want there, but a value is required.

    Now to jump to our anchor tag, use the Link tag and include a hash tag and your unique identifier.

    <Link href={'#my-unique-id'}></Link>

    Again this seems like a simple topic, but if you are new to React because you just started SPFx development, this might take you a minute to figure out.

  • SPFx Basics: How to get a query string value

    Contrary to popular belief, I still do development.  In fact, I do quite a bit of development.  In the last couple of years, I have built two mobile platforms as a service using Ionic and Angular.  This node.js based development stack positioned me well to start working with SPFx.  I'm starting up a string of blog posts that help cover the basics that I think that we often overlook in the bigger picture of how to do things with SPFx.  Today's topic is simple: reading a value from the query string.  When I recently looked at this simple scenario, I thought sure I could go back to my JavaScript roots and use location.href but there has to be a better way now right?  The SPFx team thought of that and they included a nice helper class to get you going called UrlQueryParameterCollection.

    Start by including a reference to UrlQueryParameterCollection.

    import { UrlQueryParameterCollection } from '@microsoft/sp-core-library';

    We use the getValue() Like ASP.NET or other languages, you'll usually want to check to see if it has a value before using it.  I then cast it to an integer time after reading the value.

    if (queryParameters.getValue('id')) {
            id = parseInt(queryParameters.getValue('id'));
    }

    Again, this is a simple example, but hopefully it will keep you from going down the path with location.href.  The sp-core-library has all sorts of useful utitlities for you to use such as Environment, Random Number Generators, and logging.  Check it out the next time you start out a project.

  • How to: Default a date field to today's date in PowerApps

    When you add a date field in PowerApps, I find that the current default date of 12/31/2001 is not very useful for me.

    PowerAppsDefaultDate

    Changing the default date is not hard but you have to know where to look.  First, you have to realize a date field is actually three different controls DateValue, HourValue, and MinuteValue.  The default has to be set on each one. 

    Start by clicking on the Date Value where is says 12/31/2001.  In the properties, go to the Advanced Tab and click the Unlock button. Now, iIn the property selector, look for DefaultDate and change the value to Now().

    PowerAppsDefaultDateSelected

    You'll notice the date changes to today's date now.  You can also use date manipulation functions if you want to choose another date.  Now, if you don't like the time defaulting to midnight, we can change that too.  Click on the HourValue and choose Default in the property selector.  Notice the formula it has.

    PowerAppsDefaultDateHourBeforeChange

    Let's change that to use today's date and time to get the default value with the following formula.

    Text(Hour(Now()), "00")

    You'll notice the hour has now updated.  PowerApps may apply a region identifier to your string when you update it.  That won't mess anything up.

    PowerAppsDefaultDateHourBeforeChange

    Now repeat the process for the MinuteValue with the following formula

    Text(Minute(Now()), "00")

    PowerAppsDefaultDateMinuteValueChanged

    That's all there is to it.  It may take a few extra steps than you expected but the process is pretty easy to follow.

  • Getting started with the new Microsoft Teams & Skype for Business Admin Center

    The new Microsoft Teams & Skype for Business Admin Center is starting to roll out to first release.  This post will show you some of the highlights and how to get started.  First, you have to know where to find it.  Currently, the Microsoft Teams & Skype for Business Admin Center does not show up in the list of Admin Centers on your Tenant.  To find it in your Admin Center, go to Settings -> Services & add-ins and then Microsoft Teams

    TeamsAdminCenterSettingsLink

    If the new admin center has been provisioned on your tenant, you will see a message at the top warning you that some settings are only available in the new admin center.

    TeamsAdminSettingsMigrated

    Click on the link to take you to the new admin center.  It will take you to the URL below.

    https://admin.teams.microsoft.com/

    The will take you a dashboard that looks a bit incomplete for the moment.  It lets you quickly get to your users as well as some help videos.

    TeamsAdminCenterDashboard

    On the Users page, you can see a dashboard of users, phone numbers (if any) and that one policy has been defined.  It looks like the RestrictedAnonymousAccess policy is assigned to everyone by default.

    TeamsAdminCenterUsers

    When you click on a user, you see a screen with some general information including the conference bridge and phone number (if assigned).  Here you can reset the conference ID or PIIN, set policies, and set defaults.

    TeamsAdminCenterUser

    If you click Edit next to Assigned policies, it will let you change the Teams Messaging policy but you cannot change the Teams Meeting Policy yet.  The option simply isn't present when you click on it.  I suspect that will come later in the future.

    TeamsAdminCenterUserPolicy

    If you click Edit next to Microsoft Teams, you can set the Default calling app and the Default chat appEach one has a value of Teams, Skype for Business, or Default.  However, when you try to change the Default calling app, you get an error:

    This combination of preferred applications isn't allowed.

    TeamsAdminCenterUserDefaults

    I suspect this will be resolved in the future as more of the Interop features on the roadmap are launched.

    Under Meetings, you can now manage your conference bridge phone numbers.  This is a welcome change from the old Skype for Business audio conference settings.

    TeamsAdminCenterMeetings

    Clicking Settings takes you to bridge settings include entry and exit notifications and PIN length.

    TeamsAdminCenterMeetingsSettings

    In reality, not that many settings have been migrated to the new admin center yet.  The most noticeable move will be the Messaging settings.

    TeamsAdminMessagingMoved

    Here you will see the new expanded Teams messaging policy with the ability to set more than one policy now.

    TeamsAdminCenterMessagingPolicies

    You can control External Access under Org-wide settings.  This is where you can turn off communication to external Skype (consumer) users.  By the way, Secure Score actually recommends you turn off communication to Skype users now.

    TeamsAdminCenterExternalAccess

    Under Guest Access you can control all of the settings that you allow guests of your Teams to do.

    TeamsAdminCenterGuestAccess

    That's all of the new settings for now.  Like the new SharePoint Admin Center, many of the legacy settings will take some time to migrate over to this new experience.  If you can't find the setting you are looking for, go back to the Skype for Business admin center or the Teams Settings menu.

  • Using Cloud Storage to create virtual folder hierarchies in Microsoft Teams

    One particular feature in Microsoft Teams that has been a success in my organization is the use of Cloud Storage to provide a hierarchy in Microsoft Teams. If you are not familiar with what I am talking about, I am referring to the Add cloud storage link you see in the Files tab of a Team.  You might have glossed over this link since you may be fully on Office 365, but this particular link has a lot of power.

    TeamsAddCloudStorage2

    Clicking that button will take you to a screen asking you which cloud storage provider you want to use.  In our case, we want to use SharePoint.

    TeamsAddCloudStorageChooseProvider

    However, you may have different options.  That's because they can be configured in the Office 365 Admin center under Settings -> Services & Add-ins -> Microsoft Teams -> Custom cloud storage.

    TeamsCustomCloudStorageAdmin

    Note, how most of mine are turned off.  Google Drive is about to join the off-club as well for us.  Having just migrated my organization off of G Suite this cloud storage provider approach has acted as a good transition since Google makes use of the virtual folders concept quite a bit.

    Now back when the user chooses SharePoint, it will present you a list of sites that it thinks might be relevant to you.  However, you can also paste in a link from any SharePoint site you have.  Don't worry about trimming the link or getting it exact either.  You can paste the URL of the site root, a document library, whatever.  Teams will figure out the site you want.

    TeamsAddSharePointLink

    Paste your URL,  select the site, and then click Next.  Now pick the document library you want to link in.

    TeamsCloudStorageDocumentLibrary

    Finally click Add Folder.

    You will be returned to the Files tab.  This part is a bit buggy because while the tab does refresh, it doesn't show you your new link.  Just switch off the tab and click back on the Files tab and you will then see your new link.

    TeamsWithVirtualLink

    It will create a link to the child site with a special SharePoint folder icon.  It names your folder based off of the site name and document library name.  Unfortunately, you don't have any control of that name and you can't rename it.

    When you click on the link, it will let you drill down into the document library of that site you linked in.  Notice it even maintains the bread crumbs from the Team you came from.

    TeamsChildSiite

    This is a great way to bring links to content from all over your organization into one central location.  It's pretty useful I think.

    What's the downside?

    I think the only other downside is that you can only see these links from the Teams client.  If you go into SharePoint directly, you won't see those links in your document libraries.  It's still pretty useful though.  Give it a try!

  • Understanding Site Collection creation with Microsoft Teams

    When you create a new site Microsoft Team, it creates a site collection for you rather quickly.  In general, it's ok to start working with this site collection right away.  You can upload files or do whatever you need.  However, you might have noticed before that certain menus are not available in Site Settings right away. and you can't do other administrative actions such as "Change the Look".  I started looking into this after I created a new Team and then started using Sharegate to move files there right away.  Sharegate gives me an error message that I don't have the necessary permissions to use Insane Mode.  This is no fault of Sharegate, something clearly wasn't ready yet in Office 365.

    Screen Shot 2018-03-15 at 10.02.07 AM

    I created the Team so shouldn't I be a site collection administrator?  I was confused because this was right after I successfully migrated files to a different Team that I had created last week.  It turns out even though I created the Team, I am not a Site Collection owner…yet.  The administration options are simply not there. That's because you don't have access yet. 

    I don't fully understand it, but after digging around in PowerShell, I do understand it a bit more now.  I went into SharePoint Online Management Shell and used Get-SPOUser on the site. 

    Get-SPOUser -site https://tenant.sharepoint.com/sites/teamname | Select LoginName, IsSiteAdmin

    Looking at the results, you can see that no one is a site collection admin.

    Screen Shot 2018-03-15 at 10.01.40 AM

    I suspected, I needed to wait and see what happens.  I knew my other Teams worked fine, so hopefully this one will work soon as well.  I came back about 40 minutes later, just shortly past the hour.  I then ran the same PowerShell command.  This time, the results were different.

    Screen Shot 2018-03-15 at 10.02.42 AM

    Notice how the GUID named account, ce738800-2aff-4c9f-b2cd-2b0521aa8a77_o, now is listed as a site admin?  Interesting.  After comparing the results of another Team, my account wasn't listed there as a Site Collection admin but everything there worked fine.  I decided to go back and try my migration.  Sure enough it worked.  I could use Change the Look now to change my site theme and all of my links were available on the Site Settings page now too. 

    I'm pretty sure what happens is that there is a job that runs once an hour at the top of the hour (although I am not really sure) that goes and sets permissions after the fact whenever you create a Team.  If you run into this issue, just be patient and everything should work shortly.

  • How to: Use QnA Maker with Azure Function Bots

    I have been working with bots a bit lately and wanted to share some of my experiences.  QnA Maker makes it really easy to built a bot to serve up a knowledge base based on simple question and answer pairs that you populate it with.  After you publish your knowledgebase with QnA Maker, it's a bit tricky to figure out what to do next.  When you click Publish, you get a screen like this.

    Screen Shot 2018-03-09 at 10.19.30 AM

    While this is useful information if you were going to interact with your bot directly via REST.  It doesn't tell you how to turn this into a bot.  In fact if you look for information on how to do this with an Azure Functions Bot, you'll find very little on it.  That's because all of the documentation and examples out there tell you how to do it with Bot Framework / Bot Service which is deprecated in lieu of the new Azure Functions Bot or Web App Bot. That's why I created this post to walk you through it.

    Start by creating a new Functions Bot or Web App Bot.  The difference really just depends on how you want to pay for your consumption.  If you are just experimenting, I would probably go with a Functions Bot.  You can find both under AI + Cognitive Services.

    Screen Shot 2018-03-09 at 10.37.34 AM

    You'll need to give your bot a unique name.  You'll select the typical things like the Location, Azure Storage account, and Resource Group.  The key things you want to set are the Pricing tier and the Bot template.  For Pricing tier use F0 which includes 10K Premium Messages

    Screen Shot 2018-03-09 at 10.40.47 AM

    For the Bot template, click on it choose either C# or Node.js and be sure and choose Question and Answer.

    Screen Shot 2018-03-09 at 10.40.13 AM

    You also want to set your Hosting Plan.  I am going with Consumption Plan but this is really up to you.

    Once your bot is provisioned, we now need to adjust a few settings.  This part used to be clearer with the old Bot Service stuff.  Click on Application Settings.

    Screen Shot 2018-03-09 at 10.46.35 AM

    Now we need a few values from QnA Maker.  Remember the publish screen?  It has the values we need.  We need the values for QnAKnowledgebaseId and QnASubscriptionKey.

    Screen Shot 2018-03-09 at 10.19.30 AM

    You can find QnAKnowledgebaseId in the GUID of the first line of the POST statement.  So in this case, mine is 73d71520-4c66-45ee-8fbf-acfeef3d1b05.

    You can find QnASubscriptionKey in the third line Ocp-Apim-Subscription-Key.  In this case, mine is 9343c969f7ab4ac28b559c87ae6eb3d0.

    Now we need to set these values in our Application Settings at the very bottom of the list.

    Screen Shot 2018-03-09 at 10.53.32 AM

    That's all you need to do.  Once you have configured those settings, your QnA bot is ready to go.  Try it out for yourself!

    Posted Mar 09 2018, 10:55 AM by CoreyRoth with no comments
    Filed under: ,
  • How to survive partnership renewal in the new Microsoft Partner Center

    If you managed the Microsoft partner relationship for your company, you know what the old Microsoft Partner Portal was like.  Every time I had to use it, I cried.  Microsoft recognized the problem and has come out with a brand new Partner Center.  While ultimately, the transition is a good thing, making the transition can be a bit bumpy.  Our partnership was up for renewal on 2/28/2018, so I had the distinct pleasure of requalifying our competencies on the new system

    Shift from Microsoft Account to Azure Active Directory

    In the old partner center, you logged in with your personal Microsoft Account.  This made sense to a degree because these are the same accounts that your consultants are using for Microsoft Learning and to take their exams.  Now everything is tied to your Azure Active Directory.  When you log into the old partner portal, you will be notified of the transition to the new partner center and it will tell you everything you need to make the transition.  It might be a bit more than you expected.

    Global Administrator Credentials Required

    That's right.  To make the change you need to be a global administrator of your Azure Active Directory.  For a small company like mine, that's no problem.  For a company with 5000 consultants, this is going to be an issue for you.  You are going to have to track that person down and convince he or she that you need to go through this process.  Good luck with all of that.

    Where did all of my competencies and benefits go?

    That's right they are gone in the new Partner Center.  When you click on Partnership -> Benefits, you will get a message that says:

    Benefits are not available yet.

    Awesome.  Will they be available soon?  Do I come back later?  No you have no benefits, because you lost all of your competencies in this process.  Why did you lose all of your competencies?  That's because of the change to Azure Active Directory.

    Importing Users

    When you click on View Users, you won't see the people in your org that have passed exams and associated themselves with your organization.  instead, you will see everything in your Azure Active Directory. 

    Now, if you weren't on Azure Active Directory yet, this makes things even more interesting.  We were actually in the process of moving from G Suite to Office 365.  We had an Azure Active Directory because of some Azure subscriptions, but none of our users were there yet.   Well, the Partner Center has created a process to create new accounts for any of your users associated in the old partner portal.  You just have to know where to find it.  On the User Management page, look for the link Add users using PMC data.  That's obvious right?

    Screen Shot 2018-03-07 at 8.18.33 AM

    On the next screen, it will show you what the account conversion process looks like and you have the opportunity to update account names.  When you continue, each user will get an e-mail with their account information just like the one from Office 365 when a new account is created.

    Screen Shot 2018-03-07 at 8.31.40 AM

    Action Required - Link your Microsoft Learning Account

    Your competencies are gone because there is no association between the old Microsoft Accounts of your consultants and their Azure Active Directory accounts.  Each user must log into the Partner Center URL below and then click on My Profile.  Then they have to click Associate next to Your Microsoft Learning account.

    Screen Shot 2018-03-07 at 8.44.12 AM

    https://partnercenter.microsoft.com/

    After they do that, any exams they have completed will start counting for your competencies.  However, it may take up to 24 hours for them to show up.  For a small organization, this might not be a big deal.  For a large organization, you may have to have hundreds (or even thousands) of people complete this process.  Good luck with that!

    Completing Your Competencies

    The Partner Center will automatically assign users to the relevant competencies. 

    Screen Shot 2018-03-07 at 8.49.54 AM

    However, if you are in the middle of qualifying for a particular competency, it's not obvious that people with their certifications are counting towards the competency until you have completed it.  Take a look at the example below.  We're in the middle of qualifying for Gold, but it doesn't show it.

    Screen Shot 2018-03-07 at 8.47.54 AM

    In fact, it will only show it once you achieve it.  What's even more confusing is that on the main page, it will list it as "Not Started".  The only way to see what exams are actually counting for what is to click on the Download Skills Report link at the top.  This will give you a CSV file that has the name of each MCP in your org, what exam they have passes, and what competency it counts for.

    Screen Shot 2018-03-07 at 8.51.29 AM

    Old SharePoint Exams still count

    Even though they aren't on the list, my SharePoint 2013 exams have qualified our org for the Cloud Productivity competency. 

    Screen Shot 2018-03-07 at 9.17.24 AM

    No Customer References Required

    Missing in the new Partner Center is the process that tracks customer references.  You no longer appear to need this to get your partnership.  I can't say I am missing this one bit.

    Getting your benefits

    Again, to access your benefits in the new portal, you have to requalify all of your competencies.  Otherwise, you have to access your benefits using the old portal.  Once you do qualify and you pay your fees for whatever partner levels you are purchasing, you can access your benefits from this portal.  It comes with benefits for Software, Cloud, Visual Studio Subscriptions, and Technical Benefits (Support).  You get licenses for a variety of software that you likely don't need any more with the shift to the cloud.  However, it does cover your Windows 10 licenses. For Silver, you get 10 Visual Studio Enterprise subscriptions.  Here is what the cloud benefits look like.

    Screen Shot 2018-03-07 at 8.53.41 AM

    Although we ran into a few snags along the way, I do think the new Partner Center is a good thing.  It's way easier to use and the change to Azure Active Directory makes a lot of sense.

  • Using Microsoft Flow to save copies of E-mail receipts

    If you are like me, you get a lot of receipts via e-mail for things like Internet, electricity, phone, flights, and more.  These things are usually business related, but they don't always get sent to the business account.  Before Flow, I used to go through my e-mail, save each one off as a PDF and drag it to a document library.  It was very time consuming.  Now I have automated all of this with Flow.

    In my example, I am setting up a Flow to capture receipts from my Internet provider.  First, you'll need to set up connections to wherever your e-mail is coming from.  This could be Outlook (consumer), Gmail, or Office 365 Outlook.  In this example, I set up a connection to Outlook.  Then I used the trigger "When a new e-mail arrives".  After you have added the trigger, click on Show advanced options to create a filter.  You can filter by To address, From address, or the subject.  In this case, I am looking for the Subject Filter of "Your AT&T online bill is ready to be viewed".  This will trigger the flow whenever an e-mail is received with the matching conditions.

    Screen Shot 2018-01-18 at 1.01.08 PM

    My goal is to save the contents of the E-mail as a PDF into a document library.  There is an action that lets you convert HTML files to PDF but it only works on files stored in OneDrive for Business.  As a result, I create the HTML file first in OneDrive for Business with the Create File action.  Use the Body field from the E-mail step as the File content.

    Screen Shot 2018-01-18 at 1.05.14 PM

    Now use the Convert file using path (preview) action to convert the file to a PDF.  Use the Name from the Create File action as the File Path.  Make sure Target type is set to PDF (currently the only valid value).

    Screen Shot 2018-01-18 at 1.07.16 PM

    Finally, we want to save the file into a document library where I keep receipts.  Use the SharePoint Create File action.  Specify the URL to your site first.  Then you can specify a Folder Path.  In this case I am telling Flow to save my file in the Company Documents document library and in the Receipts subfolder.  For the File Content parameter pass the File Content output from the Convert file using path activity. 

    Screen Shot 2018-01-18 at 1.13.45 PM

    You want the name of the file to be unique when it gets written to the document library.  Therefore, I use concat to create a filename with the vendor in the receipt along with the date for the File Name parameter.  Here's what mine looks like.

    Screen Shot 2018-01-18 at 1.15.31 PM

    That's it.  At this point, your Flow is ready to go.  When the flow runs, you'll see the file in your target document library if everything is correct.  Here is what the information looks like on the file.

    Screen Shot 2018-01-18 at 1.17.33 PM

    Viewing the file, you will see the PDF it created.  While the conversion process picks up the HTML formatting, tables, and CSS, it doesn't pick up the images unfortunately.  However, this is good enough for me for now. 

    Screen Shot 2018-01-18 at 1.18.32 PM

    I thought I would share this Flow today because I found it useful.  If you found some actions that you think might work better, leave a comment.

  • Create an Office AddIn with Ionic Framework

    If you want to build an Office AddIn for Word, Excel, or PowerPoint, all you really need to know is a little HTML and JavaScript.  Since Ionic Framework is built with HTML and JavaScript, it actually makes a great fit for hosting an Office AddIn.  In fact, task pane apps have a very similar shape to your mobile phone (long and narrow) so the UX elements that Ionic provides work pretty well there.  Here's an example of my Word AddIn, BrewZap menus.  It creates paper menus for subscribing breweries using the menus they manage directly from their mobile app on the BrewZap platform.

    Screen Shot 2018-01-16 at 12.19.37 PM

    Getting started with the manfiest

    An Office AddIn is essentially just a manifest XML file that tells Office the location of your web application.  You'll want to start with one of the existing manifest examples otherwise you may be missing components required to get your AddIn published in the Office Store.  You will need to provide a link to your web application as well as icons in the size of 12x12, 32x32, and 80x80.  Look through the example manifests and you should have what you need to get started.  I recommend creating two manifests: one for debugging locally and one for production use.  When you debug locally, you can simply run ionic serve and load the AddIn from the AddIns menu in Word (or whatever app you are targeting).

    Creating your Ionic app

    Create an Ionic app using ionic start and selecting the appropriate options.  I used the tab template and it works pretty well.  Once you project is created, you can start adding your code.  First, we add the reference to the office.js library to your index.html.  The Office Store requires you serve it from the CDN.

    <script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>

    Depending on what you are doing, you may actually have to load jQuery as well.  I know that seems odd in an Ionic app.  Once you have your scripts registered, you are ready to start writing some content into your Word document.  The Word AddIn example has some easy snippets you can leverage

    function insertHtml() {
         Word.run(function (context) {

            // Create a proxy object for the document.
             var thisDocument = context.document;

            // Queue a command to get the current selection.
             // Create a proxy range object for the selection.
             var range = thisDocument.getSelection();

            // Queue a command to replace the selected text.
             range.insertText('"<b>Hello World!</b>."\n', Word.InsertLocation.replace);

            // Synchronize the document state by executing the queued commands,
             // and return a promise to indicate task completion.
             return context.sync().then(function () {
                 console.log('Added html.');
             });
         })
             .catch(function (error) {
                 console.log('Error: ' + JSON.stringify(error));
                 if (error instanceof OfficeExtension.Error) {
                     console.log('Debug info: ' + JSON.stringify(error.debugInfo));
                 }
             });
    }

    I find the easiest way to apply formatting in your word document is to use HTML.  Word will interpret it appropriately and format your content.

    Testing your app

    You can develop Office AddIns in Windows, OS X, an iPad, or in the browser with Word Online.  The same API works for all hosts of your application.  However, you need to pay attention to which API you use because some are supported in different versions of the Office client (2013 vs. 2016).  You need to test them your AddIn on all platforms to verify that it works correctly.  Windows of all platforms gave me the most trouble because Internet Explorer gets used as the backend for Office AddIns.  I also had some issue with the formatting on some inputs and they didn't render correctly in Word 2016.

    Deploying your app

    You'll need to deploy the code for your app somewhere so that you can publish your app to the store.  This entails adding the browser platform to cordova and then doing a production build.  You can read my steps on how to run an Ionic PWA using Azure Web Sites for more details.  If you aren't hosting in Azure, the steps are pretty familiar still.  To do your final build for production, you will run the following command.

    ionic cordova build browser --prod --release

    You'll then copy the contents of your platform/browser/www/build folder to your production server.  Now update your manifest to point to that new server location and you're ready to go.  Once you validate it works, you can begin the Office Store submission process to get your app in the store.

    Here is what my app looks like after it has inserted a table listing the beer menu at a restaurant.

    Screen Shot 2018-01-16 at 12.30.24 PM

    Sorry for the lack of code formatting today.  I don't have a working solution to post code effectively currently.  Once I scrub some of the code, I'll post a repo with the complete solution as well.

  • Thoughts on the post-quantum computing era

    With IBM, Google, and Microsoft pouring funding into the research of quantum computing, it's really starting to look like we are going to see the benefits in the next 5 - 10 years.  Google may be just weeks from announcing they reached the quantum supremacy milestone and IBM may not be far behind either.  Today, I wanted to share my thoughts on how quantum computing may affect cryptography as we know it.

    Effects on cryptography

    When we talk about the basic cryptography used for things like TLS when you access your bank's website, the premise behind securing your data is surprisingly simple.  The certificate uses a public key which is really just a large number that's the result of multiplying two prime numbers together.  This key has a size typically between 256 bits and 2048 bits.  It's quite a large number.  To find the two factors via brute force, in today's classical computers, it would take a billion years to solve (give or take a year or two).  In computational complexity theory, they refer to these problems as intractable.  They just can't be solved with the computers we have today. 

    However, once we have quantum computers, by the nature of entanglement and superposition, it can brute force all of the possibilities using an algorithm such as Shor's algorithm in a couple of minutes.  Quantum Computers will ultimately break RSA encryption as we know it.  It will take a significant number of qubits though before this can happen.  The largest number factored to date is 56163, far smaller than a number that is 256 digits long.  This means your bank login is safe from quantum computing for a little bit longer.

    Prediction - the media will cause mass hysteria about quantum computers and cryptography

    Here is what I think is going to happen.  Some journalist looking for the next click-bait is going to stumble upon this following an upcoming advancement in the field of quantum computing.  With half the facts the journalist, will write an article with a headline such as "Quantum Computers are breaking into your bank account right now."  This will cause other media outlets to spread the word and amplify the message and people will go into a 1999 Y2K style frenzy.  Consumers will freak out.  Some will stop using the Internet for a while. 

    The thing is there are already smart people thinking about this and working on algorithms for Post-quantum cryptography.  That doesn't mean a system for post-quantum cryptography will be available at the same time we get a quantum computer that can break RSA.  We might, but I doubt it.  Assuming post-quantum cryptography for the we is still certificate based, vendors will have to start creating those certificates.  Then the web platforms like Apache and IIS will have to support it (not to mention the OS itself).  Then the browsers will have to be updated as well.  That's a lot of moving parts.

    Companies will be scrambling to figure out what to do.  I am predicting another gold rush for consulting firms (like Y2K) to help companies come up with a post-quantum strategy.  Keep in mind it's not just the ecommerce site we are securing.  It's the servers, the network communication, the connections to the cloud, etc.  Some new people are going to get rich off of this.

    I think the hysteria will happen whether it is warranted or not.  Even when we start seeing quantum computers, not everyone is going to have access to them at the scale required to break the RSA.  Even with Microsoft and IBM putting quantum compute in the cloud, most people will only have access to a small number of qubits.  To get enough quantum computer power, it's absolutely going to cost you.  That's not to say that some researcher with early access to quantum hardware couldn't "turn to the dark side and cause some mischief."  It sounds like the making of a science fiction film, right?

    Effects on cryptocurrency

    Now I am hoping the bubble of cryptocurrencies like Bitcoin pops long before we reach post-quantum computing.  I think it's going to be around for a while though.  We may be out of Bitcoins by then but one of the other networks will rise up to take its place.  I don't think a lot of thought has gone into the effects of quantum computing on cryptocurrencies yet, but I think the threat is real.  Cryptocurrencies like Bitcoin are based on SHA-256.  New blocks of bitcoins are generated basically by brute force by trying to mine a nonce to go along with the hash value.   This sounds like something a quantum computer could do quite well.  If someone were able to mine say all the remaining blocks in a cryptocurrency in a few days instead of years, that could be bad for the cryptocurrency economy. 

    This is all speculation of course, but I wouldn't be surprised if some we hear a story of some PHD university researcher who took off with a ton of cryptocurrency and disappeared off the grid in Fiji.  Sounds like another science fiction film, right?  Maybe I need to go into screenwriting.  The implications are easy to exaggerate I know.  It doesn't take much to spook and investor though.  One new story goes viral, and a bubble could pop.

    Conclusion

    I think a lot of what happens in post-quantum computing and cryptography will happen to some degree.  However, you will have to be able to discern perception and reality.  Keep an eye on the state of the industry so you know what's going on.  Then make smart informed decisions instead of knee-jerk reactions.

    If you want to start learning more about quantum computing, check out my guide on How to start learning about Quantum Computing.

  • How to start learning about Quantum Computing

    Quantum Computing is becoming quite the hot topic lately.  With research being done by Google, IBM, Microsoft, universities, and a number of other players, it’s looking this is really going to happen.  In fact, Google may just be weeks away from announcing the Quantum Supremacy milestone.  If you aren’t familiar with the concept of Quantum Supremacy yet, it’s basically the point where a quantum computer can complete a computation in a short time where a classical computer can’t complete it at all.  This is a big deal.  While there are some simple quantum computers out there right now (you can try out IBM’s via the Q Experience), this will be a big deal.

    Now, quantum computing isn't for everyone.  I'm pretty sure it's not even for myself, but I am interested in the technology so I am intrigued to learn more.  The point of this post isn't to teach you all of the details about quantum computing (because I am far from qualified to do that).  It's to teach you some of the basic concepts you should go learn about and point you to resources on where to learn more.  For my current limited quantum computing knowledge, I have learned from resources from Wikipedia, IBM, and Microsoft.  Google has some resources too, but I think most of them assume you already have a PHD in Physics or Computer Science.  I found that some of the resources do a better job at explaining concepts than others.  Since this is a complex topic, you can learn something from reading each of them.  I will warn you, that this stuff is complicated.  It's got to be if quantum computing is going to be as revolutionary as predicted.  With a Computer Science degree, I learned about a lot of these concepts while at University, but I have long forgotten these things.  Let's face it, you don't use things like Linear Algebra much when you are creating an Intranet in Office 365.

    What follows below is some of the key areas of quantum computing that I think you will want to learn more about.  There's a lot to learn about quantum computing, but this should give you some good building blocks.

    What is Quantum Computing?

    The promise of quantum computing is that they will be able to solve computational problems in minutes or hours versus years on classical computer.  It all starts with qubits and how they interact with each other.   To understand more, start by reading an Introduction in the Beginner's Guide of the IBM Q Experience.  Then go read Microsoft's take on it.  They also have a short video about it.  Finally, if you want to go deep, read up on Wikipedia.

    Who are the players?

    IBM, Google, and Microsoft have all been in the media a lot lately with announcements.  If we were to compare this to the space race, IBM has someone in orbit, Google is about to plant a flag on the moon, and Microsoft just decided what type of rocket fuel to use.  I think Microsoft picked a compelling type of rocket fuel though, topological quantum computing.  They have a world-class team working on it too.  D-Wave Systems was the first company to have a commercially viable quantum device but it's limited to specific scenarios.  This is not to discount the teams of university researchers that these companies have partnered with throughout the world as well. 

    One company you may notice that is sitting on buckets of cash but is remarkably missing is Apple.  Apple has not announced any research in quantum computing at this point.  There are a lot of theories on this, but since Apple can't make a quantum computer "pretty" and overcharge for it, I don't think it's ever going to happen.

    Greek Letters

    If it's been a while since you've looked at the Greek Alphabet, you better go do so now.  Due to the amount of linear algebra involved, there are Greek letters everywhere, and while you might remember Alpha or Beta, remembering Psi, Phi, and Theta might be a bit harder.  When you are reading through the documentation, pull up the article on Greek Letters on Wikipedia and keep it handy as a reference.

    Linear Algebra

    To understand the world of quantum computing, you need to understand several linear algebra concepts.  Specifically, you need to understand the concept of vectors and matrices.  You'll want to understand their notation and the operations on them.  For example, you'll need to understand how to add and multiply matrices together and the tensor product.  The Vectors and Matrices article in Microsoft's quantum computing concepts section is quite good.  The following section on Eigenvalues and Eigenvectors is important as well.  They also recommend the book Linear Algebra (additional materials) Third Edition by Jim Hefferon (available for free at the links).  If you've never studied linear algebra (or it's been a while), it might be worth reviewing that book as you get into things.

    Qubits

    Whereas bits are the basic object of classical computing, qubits are the fundamental object of information in the quantum computing world.  However, they are significantly complex.  Like a bit, they can have a value of 0 or 1, but both at once through a process called superposition.   We can visually represent a single qubit with something called a Bloch Sphere.  This sphere has a radius of one with an X, Y, and Z axis.  This may not make sense yet, but it actually helps us later when we are trying to understand how gates transform a qubit later.  IBM has a pretty good description of Qubits and the Bloch Sphere.  However, it made more sense to me, when I read through Microsoft's description.

    Column vectors are the basis of representing qubits.  When we perform operations on the qubit, we are effectively transforming those vectors (or matrices when there are multiple qubits).  However, column vector notation can be a bit cumbersome at times.  That's where Dirac notation comes in.  In the Q Experience getting started guide, they talked about the 0 and 1 states being represented as |0> and |1>, but I didn't really pick up why there.  Microsoft has a page on Dirac Notation that explains it quite well.   When you start representing multiple qubits in Dirac notation, they will look something like |01> or |00>.  However, it wasn't clear to me until I read the IBM documentation that the qubits should be read from right to left.  That means the qubit on the right is the first qubit.

    Operations / Gates

    In a classical computer, there are only four functions (AND, OR, NOT, NAND) that map bits.  In quantum computing, there are an infinite number of possible transformations on a single qubit.  However, in reality, there are only a few that you deal with in these early examples.  The gates are all named after mathematicians and theoretical physicists that have long past.  Remember, we have known about quantum computing for some time.  We just didn't know how to get there.  When looking at the gates it may be easier to think of what the gate does when represented on the Bloch Sphere.  There are gates known as the X, Y, and Z gates.  They correspond to operations on the accesses of the sphere.  For example, the X gate is thought of as a "bit-flip" where it is effectively flipping 0s and 1s in the matrix representation of the qubit.  The Q Experience Beginner's Guide explains this gate fairly well.  Throughout their guide, you can also click on a link to open the composer where you can actually try out these operations on a simulator and even their working quantum computers.  The Y and Z gates do similar operations around their axis.  If you want to get more into the math behind all of these operations, the Microsoft page has quite a bit of detail.

    To put our qubits in a state of superposition, you use the Hadamard gate, often labeled as an H gate.  To learn about the H gate, check out the Creating Superposition page on the Q Experience first.  You'll use this gate a lot as you're starting to experiment.

    Entanglement

    When using the Controlled NOT (CNOT) gate, we can put multiple qubits into an entangled stage.  What happens here is that when two qubits are entangled, when you measure one qubit it affects the other.  This concept is a bit harder to grasp, so I've got a number of references.  First, look at Microsoft's page on Multiple Qubits  You can  read a bit more from IBM.  However, once I tried it out in a simulator (step 6), I think it made the most sense.

    Experimenting with the IBM Q Experience

    The best way to understand some of this is to try some experiments.  I started with using the IBM Q Experience.  It's been out for some time so I looked at it before Microsoft's Quantum Development Kit Preview came out this week.  The Q Experience has a Composer, where you can visually drag and drop your gates onto qubits to run an experiment.  There, it will show you which quantum computers are available and interesting facts should as what temperature the dilution refrigerator is running at.

    QExperienceQuantumComposer

    You can drag and drop gates anywhere you like and then choose to Run or Simulate your results.  This provides a visual representation of the underlying code going into the quantum computer.  You can click on Switch to QASM Editor and you will see the code.  If it looks like classical assembly language to you, that's because it's very similar.  Remember, we're just dealing with qubits and gates here.

    You can sign up for an account with the Q Experience and it will give you a fixed number of executions each day on an actual quantum computer.  IBM current has 5 qubit and 16 qubit quantum computers in the Q Experience.  Right now, it looks like the 16 qubit machine is offline because it's not showing any longer.  Sometimes the Run button won't be available at all though.  This all depends on the availability of the quantum computers as they take them down for maintenance regularly. 

    Just launching the composer is a bit daunting though.  Instead it's easier to start with existing experiments throughout the Beginner's Guide.  For example, on the CNOT page, you can run a variety of pre-configured examples in the Composer.  This is a great way to learn quickly and actually try your results on a real quantum computer. 

    Experimenting with the Microsoft Quantum Development Kit Preview

    This week, Microsoft released the Quantum Development Kit Preview.  Microsoft doesn't have a quantum computer yet, but they have quite the development stack already.  Using your own computer (and later Azure), you can simulate a quantum computer in Visual Studio 2017.  Installation isn't too hard but you need to do it on actual hardware (not a VM).  I think some Virtual Machine hosts do support the necessary CPU features if enabled though.  Let's be clear though, simulating a quantum computer is CPU intensive and can be slow depending on the complexity of your algorithm. 

    I'll be posting a detailed walk through of the development kit pretty soon so I won't go into a lot of detail here today.  Once you have the kit installed, go through the Quickstart.  It walks you through a program from the ground up.  To date, this has helped me learn some of the most about quantum computing yet.

    When will quantum machines be commercially available?

    We are starting to see a number of successful prototypes in the works now.  From last I read, IBM is targeting 2021 and Microsoft says around "five years", so 2022.  I suspect Google may be closer than that.  That may seem pretty far off but it's really not in the scheme of things.  The field of quantum computing actually started in the 1980s and it has taken us this long just to get where we are. 

    Why should you care?

    Quantum computing isn't for everyone.  That's true.  However, once we enter a post-quantum computing era (and we will), the benefits will eventually affect you.  I'm picturing a Y2K style gold-rush caused by quantum computing in the next ten years. I absolutely believe in quantum computing and while I'll never be capable of contributing directly to the research, I think I can help evangelize it.

    I also recommend watching this keynote from the Microsoft Quantum team at Future Decoded.  It has some great visual representations of quantum computing as well as what industries it may make an impact in.

    Summary

    When it comes to quantum computing, there is a lot to learn.  You are not going to learn it all in a day.  When you are reading about quantum computing, it's easy to get lost.  That's ok though.  I've read several of these pages multiple times, and I pick up a little more each time.  I'll keep this post updated as I find other good resources.

    Finally my usual disclaimer.  I'm far from an expert in the field of quantum computing.  If I got something wrong here, kindly correct me in the comments as opposed to trolling me.

  • How to: delete a SharePoint List Form customized with PowerApps

    Building SharePoint List Forms with PowerApps is starting to roll out.  As you customize your forms, you may get to a point where you want to delete one of them.  When you customize a SharePoint List Form in this manner, the PowerApp itself doesn’t show up in your list of apps so you might be wondering how to delete the form itself.  It’s not too had, once you know where to look.

    Before you go an delete your form, keep in mind that you can roll back to any previously saved version using the version history.  Just click on File, Save, and then See All Versions.

    Screen Shot 2017-11-16 at 3.13.18 PM

    Just click the Restore button if you need to go back a version.  If you have the PowerApp open in an editor in another browser tab, you’ll need to close that first.

    If you really need to do delete the PowerApp though, you can do that from the List Settings on the SharePoint list itself.  Click on the Form Settings link.  This is where you used to go to turn on and off InfoPath back in the day.  First, select Use the default SharePoint form.

    Screen Shot 2017-11-16 at 3.16.12 PM

    Next, select Delete the custom form.

    Screen Shot 2017-11-16 at 3.16.25 PM

    Click OK on the confirmation and the custom PowerApps form for your SharePoint list will be gone.  You can now choose PowerApps –> Customize forms again to start over with a new form in PowerApps.

  • How to: Hide fields in SharePoint list forms using PowerApps

    I’ve been building forms for a number of business processes lately using PowerApps and some of my tenants recently received the ability to customize forms in SharePoint lists using PowerApps.  One common scenario is that you might want to show or hide different fields depending on whether the user is creating a new item or editing an existing one.  I tried a number of approaches while experimenting with the visible field.  It wasn’t quite obvious to me at first, so after watching the following video that Chris Webb sent me a link for, I figured it out.

    For our scenario, we have a simple travel request form. The requester will fill out fields on where they are going.  The approver will edit the form and fill in comments and mark it as approved.  The requester shouldn’t see these fields.  In this example, we could actually use Approval Flows and what not, but for this example we are keeping it simple.  Let’s start by looking at our default form.

    Screen Shot 2017-11-16 at 10.25.25 AM

    Start by selecting the field you want to hide and then click on the Visible property. 

    Screen Shot 2017-11-16 at 10.26.42 AM

    Now, set the value equal to the following formula.

    If(SharePointForm1.Mode = FormMode.New, false, true)

    Screen Shot 2017-11-16 at 10.29.06 AM

    This hides the field when the form is in new item mode and shows it for view and edit.  You can customize this to your needs for other views as well.  You can preview what the form looks like in different modes now by clicking on SharePointForm1 and then changing the Default mode property between New and Edit.  For example, here is what my New form looks like now.

    Screen Shot 2017-11-16 at 10.33.43 AM

    Save and Publish your form and then you can try it from within SharePoint.  Now, when I click on the New button, the other fields are hidden.

    Screen Shot 2017-11-16 at 10.35.46 AM

    When I edit an existing item, we see the fields that we hid on the new form.

    Screen Shot 2017-11-16 at 10.37.19 AM

    Like many things in PowerApps, hiding fields is pretty simple once you know the right formula.  It took me a bit to figure this out because I think I was approaching this more from my developer background.  When I start to think about the old Excel formulas I used to use, it actually makes a lot of sense.

More Posts Next page »
2018 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems