Blog Post

Adding Microsoft MVP Contributions with PowerShell – Lessons Learned using the MVP API

,

One of the things that brings Microsoft MVPs together each year is complaining about the pains of reporting community contributions to Microsoft.

This is a typical first world problem, but with a history of reporting tools ranging from temperamental Infopath forms to websites where you painstakingly click here and there for hours, there have been reasons for the complaints.

This year I decided to try out using PowerShell to add my contributions. This has been available for about a year thanks to François-Xavier Cat and a few friends, but I’d completely forgotten that it was possible until William Durkin reminded me about it on Twitter.

First time ever, I didn’t wait until the last minute to start thinking about my annual contributions. Instead, I took a little time to learn about how this works — and now I’ll keep my contributions in a spreadsheet and then upload them right before the deadline.

Here are my notes on what I found, and why I’ll still wait to upload.

Some setup is required

The documentation for setup is quite good. I used the main documentation and it went very smoothly.

One note: in the docs it mentions that your request will be reviewed and accepted by an administrator within a couple of business days. Mine appeared to be auto-approved and I didn’t have to wait at all, I was able to start using my subscription right away.

Caching sounds great, until it’s not

There are only two hard things in Computer Science: cache invalidation and naming things.

Phil Karlton

The most painful part of uploading contributions with PowerShell wasn’t getting the upload to work: it was figuring out that the cache for the MVP website doesn’t get cleared by PowerShell uploads which use the API.

This means that the contributions you see on your profile on the website are probably not the current version at all if you’re uploading via PowerShell, because that cache is way out of date.

This is true if you are:

  • Looking at your contributions from a logged out state
  • Editing your contributions while logged in. The website doesn’t even invalidate the cache reliably if you’re editing your contributions, I’ve found ??

Workaround: export all your contributions to a .csv file from the API and review them that way

I’m no scripting genius, but I came up with a simple command to export all my contributions for review:

 
Get-MVPContribution -Limit 500 | export-csv exportedcontributions.csv

This also gives you the ContributionId for each of your contributions, in case you want to delete any.

Inserts are easy, updates are hard

One of the main questions I had when starting out was whether re-running New-MVPContribution would be smart enough to identify matching existing contributions with the same date and description, and update other information, such as the ‘AnnualReach’.

Why this matters: Microsoft doesn’t publish the criteria they use to select MVPs, but if I was them, I’d pay a lot of attention to those reach numbers.

So when it comes to items like videos, I want to report the reach at the end of the review cycle, not just after I post the video.

Finding: New-MVPContribution does not find and update contributions. If you rerun an import for a .csv file with contributions, it’s very easy to create duplicates.

If you accidentally create duplicate contributions, no worries

It’s simple to get a list of all your contributions using Get-MVPContribution (see my workaround above), and then run a delete loop using the ContributionIds with code like this sample in the documentation.)

All in all, I like this way of managing contributions

My new way of doing this is…

  1. Use a simple spreadsheet saved as a .csv file to track my contributions: I’ll update it once a month with a summary of the talks that I’ve done that month, and links to videos I’ve posted.
  2. A couple of weeks before contributions are due, I’ll update the reach numbers for the videos in the spreadsheet. I’ll also add in entries for aggregate information where helpful — for example, I add a single line for all my blog posts with reach information, instead of a line for each post. Then I’ll do a single upload for the year from the .csv file.
  3. After upload, I’ll manually edit a contribution in the GUI and see if this triggers a cache clear to validate display of the contributions (I’ve had mixed results). Setting a reminder to see how they display the next day isn’t a bad idea, either.

It’s certainly not perfect, but it’s waaaaaaay better than an old infopath form, so I’m happy to have it.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating