in

Dot Net Mafia

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

This Blog

Syndication

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2010, Office 365, SharePoint Online, MOSS 2007, ASP.NET, LINQ, and Visual Studio 2010
  • Error: Update-SPProfilePhotoStore : Object reference not set to an instance of an object

    I like blogging about errors and their resolutions.  Sometimes the answer is simple, but I think there is a lot of value in posting the details of an error so that users can find answers in the search engines.  After doing a My Sites upgrade from SharePoint 2007, you will have a whole heap of user photos that you need to beat into submission.  This command goes through all of the existing user photos and creates thumbnails.  This is often useful when a user has uploaded a giant image of themselves and you need to fix it.  To do this, you may be familiar with the PowerShell command Update-SPProfilePhotoStore.  You call it by passing the URL to your My Sites host.

    Update-SPProfilePhotoStore http://mysitehosturl

    If you don’t have the right permissions, you will find yourself with the following error:

    Update-SPProfilePhotoStore : Object reference not set to an instance of an object.
    At line:1 char:27
    + Update-SPProfilePhotoStore <<<<  -MySiteHostLocation
    http://mysites
        + CategoryInfo          : InvalidData: (Microsoft.Offic...ofilePhotoStore:
       SPCmdletUserProfilePhotoStore) [Update-SPProfilePhotoStore], NullReference
      Exception
        + FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.
       SPCmdletUserProfilePhotoStore

    UpdateSPProfilePhotoStoreError

    Now clearly to you that means you don’t have the right permissions, correct?  Of course not.  To run this command, you need the permissions as defined in this post on MSDN blogs.  Now, you could take the easy way out and just run PowerShell as the farm account.  However, I know you know better.  Just go set up the right permissions and you’ll be set.  The post on MSDN summarizes them as follows:

    • Go to Service Applications, select your User Profile Service Application, and then click Permissions.  Add your account and check the Full Control checkbox.
    • Select the User Profile Service Application, and then click the Administrators button.  Add your account there and check the Manage Profiles checkbox and nothing else.

    Note that you can add groups on the Administrators section but you can’t on the Permissions section.  Once you do that, run PowerShell with the Run as Administrator option and run Update-SPProfile again.  It should execute without an object reference error.

  • Slides from my Visual Studio 11 talk at SharePoint Saturday Houston

    I survived another SharePoint Saturday in Houston this weekend and had a great time.  It was fun seeing old friends and making some new ones as well.  As promised, here is a link to my slide deck posted on SlideShare.  Thanks again to Victor and all of the volunteers and sponsors who made it possible.

    New SharePoint Development features with Visual Studio 11

  • My simple PowerShell script for finding those troublesome Correlation IDs

    ULS Viewer works great for finding Correlation IDs but once you start dealing with large farms, I find PowerShell works much better.  A Correlation ID is great but it doesn’t do you any good if you can’t find it in the logs.  I put this script together through the help of posts from Wictor and others.  Using Get-SPLogEvent you can find pretty much anything you need in the logs, but without the right parameters it can run very slowly.  I’ve seen some scripts try to filter Get-SPLogEvent using a | but performs the filtering after it retrieves everything from the database.  The key to using Get-SPLogEvent is to use the –StartTime parameter.  You can obviously manually type in a date / time yourself but I find it much easier to calculate it with PowerShell.  To do this use Get-Date and then call the .NET DateTime method AddMinutes().  By limiting the scope to the last five minutes or so the call will execute much faster.  Here is what it looks like.

    Get-SPLogEvent -StartTime (Get-Date).AddMinutes(-5)

    You can then pipe the output and compare the Correlation with the –eq parameter:

    Get-SPLogEvent -StartTime (Get-Date).AddMinutes(-5) | ?{$_.Correlation -eq $CorrelationId}

    The value of $CorrelationId just comes in the command line with the following statement at the beginning of the script:

    Param([string] $CorrelationId)

    That gets us some results for the correlation id in question.but then you really want to format them.  We’re really only interested in the Category and Message fields from the logs.  You can optionally add the Timestamp field if you need the exact date / time.  We can format the results with Format-Table (or the ft alias).

    Get-SPLogEvent -StartTime (Get-Date).AddMinutes(-5) | ?{$_.Correlation -eq $CorrelationId} | ft Category, Message –AutoSize

    This format the results in a table but by default it constrains the width of the data to the size of your PowerShell window.  Often the details of that exception far exceed the default width.  To mitigate that, you can use the Out-String cmdlet and a –Width parameter.  I would go with a value of 1024 but you may need a higher value like 4096.  Experiment with it as necessary. 

    Get-SPLogEvent -StartTime (Get-Date).AddMinutes(-5) | ?{$_.Correlation -eq $CorrelationId} | ft Category, Message -AutoSize | Out-String -Width 1024

    At this point, any entry corresponding to the Correlation ID are displayed in the PowerShell window.  However, that’s not always very readable so I usually like to output the results to a text file.  For that, I just use the old Unix style > operator and specify a filename.  Here’s what the entire script looks like together.

    Param([string] $CorrelationId)
    Get-SPLogEvent -StartTime (Get-Date).AddMinutes(-5) | ?{$_.Correlation -eq $CorrelationId} | ft Category, Message -AutoSize | Out-String -Width 1024 > log.txt

    Save your script in a file (i.e.: GetSPLogEvent.ps1).  You can then run it pretty easily with the following command.  Just pass a GUID to the –CorrelationId parameter.

    .\GetSPLogEvent.ps1 -CorrelationId "a61775bd-a46f-4353-b62c-d4db3ec6cfea”

    GetSPLogEventPowerShell

    I then take a look at the output file log.txt to see the results:

    GetSPLogEventResults

    This is one of these cases where you can combine many different aspects of PowerShell to make your life easier.  Try out the script for yourself the next time you need to track down an error.

  • SharePoint Saturday Houston this weekend!

    I am excited that it’s already time for SharePoint Saturday Houston again this Saturday on 4/28.  We already have more than 500+ people registered and it is sure to be a huge event.  I’m speaking about new SharePoint Development features in Visual Studio 11.  It’s a fun talk because it lets me pretend I am still a developer.  I did build a web part today so maybe I still am. :)  If you haven’t registered yet, you better do it fast.  I think there is already a waiting list.  Many thanks to Victor and all of the many sponsors, volunteers, and speakers that make this event possible.  I can’t wait to see everyone!

    SharePoint Saturday is located at Norris Convention Center (803 Town and Country Boulevard, Houston, TX).

    Also check out the Houston SharePoint Users Group.

  • FAST Search for SharePoint document previews don’t work with Claims Based Authentication

    Recently, I became aware of this troublesome issue in regards to document previews with FAST Search for SharePoint.  It was on a new installation of SharePoint.  I had everything indexing great and my search results looked good.  However, after a while, I noticed that document previews were not appearing for our documents stored in SharePoint.  After further investigation and some discussion with some colleagues, we discovered that FS4SP had an issue with Claims Based Authentication as described in KB2641517.  The article describes the issue and makes it pretty clear what you have to do to make it work: switch back to classic authentication.  I wanted to go into a bit more detail about what is involved in that work-around though.

    If you are familiar with claims at all, you may know that you can switch a web application from classic authentication to claims, but you may not switch back.  That means any work-around you pursue can be a bit involved.  Before, you start ripping your farm apart though, it is best that you understand where the issue with claims is.  In reality, it is not an issue with the web application that hosts your search center.  It can actually be running claims and document previews will work.  It’s the web application that hosts the documents themselves.  For example, if you have web application A running claims and web application B running classic, you will get document previews for the documents on web application B even if the search center was running on web application A.  The reason I point this out is so that you don’t just try throwing your search center on a classic authentication web application hoping that it will work.

    That means if you want to get document preview working, you have to detach your content databases, delete the web applications, reattach the content databases, redeploy your solution packages and hope for the best. :)  It really shouldn’t be that big of a deal, but you should definitely plan ahead if you are going to make that kind of change.  From my understanding it has something to do with how the claims based application talks to Office Web Apps.  Office Web Apps works fine with claims based web applications when it comes to viewing / editing, so I don’t know why it’s an issue here.  I’ll let an expert on claims answer that.  Anyhow, I hope this insight helps should you run into this issue.

  • File not found error on AllItems.apsx list pages using KWizCom web parts

    Recently, a client of mine acquired some KWizCom web parts.  I installed them and they seemed to work fine.  However, during the configuration, we ended up building a new web application or two.  On these web applications, I started to notice that we were receiving File not found errors whenever you went to AllItems.aspx on any list page (i.e.: Shared Documents, Web Part Gallery, Solution gallery, etc).  I immediately thought it was an issue with how I was applying custom branding but that turned out to not be the case.  Ultimately, I started seeing this issue on brand new web applications and site collections and I knew something had to be up.  Whenever I visited one of these pages that had the issue I got the following error.

    File Not Found. 

    FileNotFoundError

    When this occurs you can view the Web Parts Maintenance Page but it is of no help obviously.  Ultimately, I queried the ULS log using Get-SPLog using tips I picked up from Wictor.  Be sure and use the –StartTime parameter to limit the scope of the query.  It will return something much faster.  Just paste your Correlation ID in the script and you are good to go.

    Get-SPLogEvent -StartTime (Get-Date).AddMinutes(-5) | ?{$_.Correlation -eq "74adb0a7-655a-473b-9afa-5cc9edcc1aed"} | ft Category, Message –AutoSize

    After the script executed, the culprit finally stood out.

    kWizComFail

    There from the snippet, you see mention of KWizCom.  Now it is all making sense. In this case, we had some of the web parts that do various things to lists.  As my first attempt at a solution, I redeployed all of the KWizCom solution packages.  That still didn’t help though.  I then tried activating all of the site collection features from KWizCom to see if that made a difference and that didn’t work either. Finally, I just retracted all of the solution packages and my lists started working again.  I haven’t yet redeployed the solution packages, but I suspect they should probably work, but it makes me leery.  This was killing brand new web applications.  When I try it again, I’ll update the post.

  • Excited to be speaking at TechEd this year

    I am excited to say that I’ll be speaking at both TechEd North America and TechEd Europe.  This is my first time to even attend a TechEd so I am looking forward to see what is in store.  Both events are sure to be exciting but I am particularly excited to be going to Amsterdam for TechEd Europe since I haven’t been in 10+ years.  If you’re at either event, be sure and check out my session on Making the most of Search with SharePoint Online.  There you will learn some great tricks on how to get more out of your search experience in the cloud.  Links to my sessions are below.

    TechEd North America

    TechEd Europe

    If you’re going to be at either event let me know.  I am looking forward to seeing old friends and meeting some new people.

    Follow me on twitter: @coreyroth

  • There’s an app for that, but should there be?

    As I have made my transition from an iPhone 4 to a Nokia Lumia 900 running Windows Phone 7, it has got me thinking about the state of the app market.  Keep in mind before you start hating, that I have carried an iOS device for the past four years so I feel like I can objectively compare these mobile app stores.  Not to mention the other iOS devices floating around here such as iPads (although I never actually paid for one).  No question iOS has more applications than any other mobile platform.  However, I venture to say that 90%+ (totally a subjective number) are total garbage or shouldn’t be an app to begin with.  We’ll break that apart.  According to Apple, they have over 500k apps.  What is not published is the number of apps that have a one star rating or have just been flat-out deleted from people’s devices.   Think about how many apps you have downloaded and then never used again.  How many apps do you have that you launch less than once?  I refer to these as single-use apps.  So sure, Apple has more apps than Android and Windows Phone but how many of those are nothing but fart applications? 

    Let’s put quality aside though because Android and Windows Phone have their share of stupid apps that somehow people are making money on.  I introduce a new category of app that I refer to as the glorified web browser.  These are apps that really don’t bring you anything more than you could get by pointing your mobile browser to a web site.  What are examples?  Amazon, eBay, Yelp, USA Today, Facebook, YouTube, Google Search, Dictionary.com, Walgreens, IMDB, Southwest, United, Craig’s List, etc.  You get the idea.  Some of these apps might mix it up a bit and provide some unique features or push notifications, but in the scheme of things all of these apps do is render the same data you would get inside your browser.  Think about it.  Do you really need an app to interface with an E-commerce site?  All that is doing is taking up space on your phone.  It’s not that it taking up valuable space in memory either.  It’s screen real estate.  This is half the reason why Apple had to add folders to iOS so you had a place to hide away these seldom used applications.  I’m sure many of these apps have been successful, but I don’t think they are bringing a ton of value.  Most of them I can live without.  Facebook is an excellent example.  Those developers have such a mastery of HTML that the mobile web site almost looks like an application.  With so many apps that I really don’t need, I decided I could afford to make the switch to Windows Phone to pick up some of the features it provides that I really like.

    So in my opinion, what makes a good app?  Here’s my list

    • Games
    • Audio streaming applications – i.e.: Pandora, iHeartRadio
    • Apps that make use of phone specific features
    • Books
    • Applications with Offline functionality – SharePoint Workspace Mobile
    • Communications apps – Skype, Lync
    • Apps that interface with devices – i.e.: Sonos, Pioneer Elite, Comcast, DIRECTV

    I am sure there are other examples as well, but I think that’s a good list to start with.  Games is the most obvious one.  If you look at the top 100 apps, you’ll see no shortage of them.  Are there apps that I wish I had on my Windows Phone?  Of course, but there is nothing I am so dependent on that it’s a show stopper.  I know this may sounds like I am just trying to justify my Windows Phone purchase, but it makes sense to me.  Apple fans may not agree with me and that’s ok.  I having been one in the past know that there is no arguing with them.  :)

  • What are your options for a test environment with SharePoint Online (Office 365)?

    I’ve seen this conversation come up a few times.  Deploying code to SharePoint Online is not like deploying code to your test and production environments back on-premises. I thought I would give my thoughts on it and that will help you make a better decision.  Office 365 is not like Azure in the fact that you can simply spin up another web role for testing.  Nor do we have the ability to deploy code to one role and then swap it into production like we can with Azure either.  That means we have to get more creative.  Sure, you can develop code locally on a local SharePoint 2010 server and deploy it.  You can even use Visual Studio 11 to help you publish the solutions to the cloud faster.  However, this isn’t necessarily a good “test” environment since SharePoint 2010 and SharePoint Online have a lot of differences.

    Effectively, the way I see it, we have two options for a test environment.

    • Create a new site collection
    • Create a new Office 365 account (tenant)

    I know what you are thinking.  As a traditional developer building on-premises solutions, neither of these sound ideal.  Maybe they are not, but they actually make a lot of sense when we start thinking about it.  Let’s look at each option in detail.

    New Site Collection

    Now when this may not make sense for your on-premises farm solution.  It actually makes quite a bit of sense at the site collection level.  Think about it.  Our goal is providing a separate environment.  Well, pretty much everything you do with SharePoint Online operates within the sandbox of the site collection.  This includes solution packages which are published to the site collection’s solution gallery.  This makes it an ideal way to test customizations such as web parts, lists, content types, and more.  Simply create a new site collection, publish your customizations, test it out.  When you are done, you can even delete the site collection and create a new one when you need to test again.  Your code will not affect anything in the other site collections.

    When will this not work?  When your code requires you to make changes at things at the tenant level.  For example, if you are testing some new term sets in the Managed Metadata Service or your solution is querying search.  If you were making use of the BCS, this might not be a good option either.  In essence, it works well for testing things like web parts and the use of the Client Object Model, but not so well for tenant based features.  For those features, it’s time to start looking at spinning up another Office 365 account.

    New Office 365 account (tenant)

    When you need to ensure that everything is absolutely separate in the cloud, the only way to do it is with another Office 365 account.  Go to try.office365.com and create a new account with a new prefix.  I’d recommend using a prefix that is easy to remember and indicates you are on the test environment.  For example, if your main domain is company.sharepoint.com, create something like companytest.sharepoint.com.  The benefit of creating a new account is that your service applications such as search, BCS, and the Managed Metadata service are truly separate.  You can also rest assure that nothing you do on this account, will affect your production account.

    Probably the biggest drawback of this approach is that you have to maintain completely separate user accounts.  This can prove to be an inconvenience but it’s not terrible.  There may be some risk if you are testing permissions within your application, but you just have to deal with that.  Another drawback of this approach is that none of your data from your “production” SharePoint Online site will be present.  You’ll have to either manually upload it, deploy it with code, or look at a third party migration tool.

    One other benefit of this approach is that you can just use a trial account.  Trial accounts are good for 30 days before you have to start paying.  This very well may be long enough to get you through your test cycle.  If your test cycle runs longer than that you can always just purchase a few licenses.  Keep in mind that Enterprise plans have a one-year term though.

    Summary

    These are the options I have came up with for testing customizations in the “cloud”.  I tend to go with just creating a new site collection, but I am sure I will find a change that warrants creating a completely separate account.  Have you come up with any other techniques for testing with SharePoint Online?  Post them here in the comments.

    Follow me on twitter: @coreyroth.

  • Slides from my SharePoint Online and Visual Studio 11 talks

    It’s been a busy month for speaking (among other things).  Last month, I spoke about getting started with SharePoint Online development at SharePoint Saturday New Orleans.  The New Orleans crew (Cherie, Beth, and Tiffany) did a great job putting the event together.  Here are the slides that I referred to in that talk.

    Office 365 – Introduction to SharePoint Online Development

    Last week, I made the trip over to San Antonio to see Tom Resing (@resing) and the fine folks there.  There I presented to a full room of people looking to learn more about the new SharePoint development features in Visual Studio 11.  If you have been following my blog lately, you know I have been posting a lot about the new features lately.  As promised, here are the slides from that talk.

    New Development Features in Visual Studio 11

    For my next presentation, I’ll be speaking this week at the Houston Cloud Tech Symposium on 4/4.  This is a new event for me so I’m not sure what it will be like.  I’ll be talking about how you can use SharePoint Online for Extranets.  If you are in Houston this week and are attending the event, come see me.

    Finally, I’ll be presenting my Visual Studio 11 talk at SharePoint Saturday Houston later this month on 4/28.  That event is always no less than epic so you need to be there.

  • Speaking at SharePoint Saturday New Orleans and San Antonio SharePoint Users Group

    I’m excited to be speaking at a number of events over the next few weeks.  The first event is SharePoint Saturday New Orleans this weekend on 3/24.  There, I’ll be speaking about developing solutions for SharePoint Online (Office 365).  This new talk will be packed full of information, tips and more.  We’ll even look at how we can use Visual Studio 11 Beta to make deploying to the cloud easier.

    Then on Tuesday of next week (3/27), I’ll be speaking at the San Antonio SharePoint Users Group.  This is my first appearance there and I’ll be showing off the new features in Visual Studio 11 for SharePoint development. 

    Then on April 4th, the Houston Cloud Tech Symposium is coming up.  I’ll be speaking about using SharePoint Online as an extranet.  That’s the day after my birthday but I’m sure everything will be fine. :)

    Finally, to wrap up April (4/28), we have SharePoint Saturday Houston.  For those of you who have been before, you know that this event, it will be no less than epic.  Last year will be hard to beat.

    I’m excited about all of these events coming up.  All of these are brand new talks so I hope they are good. :)

    Follow me on twitter: @coreyroth.

  • VMWare Workstation running on a Windows 8 Host

    When I am booted into Windows 8, I often find myself wanting to run some of my existing virtual machines that I created in Oracle Virtualbox of VMWare Workstation.  These products do run under Windows 8 but there are a few things you need to know.  First, you need to know that VMWare Workstation does not get along with the Hyper-V role.  I am excited to try out Hyper-V and see if it can become my full-time virtualization platform.  However, if you do install that role, when you launch a virtual machine in VMWare, you will be told that it is not compatible with Hyper-V and it will simply not run.

    Since it will take me some time to get my virtual machines running on Hyper-V, I am not ready to make that jump yet.  I removed the Hyper-V role and then fired up VMWare Workstation again.  When I launched the virtual machine, I got an error about vmci.sys.  This actually used to work prior to installing the Hyper-V role.  I first tried a repair on the VMWare Workstation installation.  Unfortunately, that did not work.  Next, I uninstalled VMWare, while preserving my license and virtual machine configuration.  Once, I reinstalled, I could launch my virtual machines again.

  • Understanding versioning with Excel Web App

    If you have used Excel Web App (part of Office Web Apps), you are familiar with the fact that there is no “Save” button.  The changes you make are immediately saved back to SharePoint and you even have multiple people editing the spreadsheet at the same time with Co-authoring.  I had always wondered what happened when it comes to versioning so today I decided to dig a little deeper to find out what happens.  We’ll start with editing an Excel document in the browser with versioning enabled.  Whenever you change the value of a cell, the results are immediately saved back to SharePoint.  However, opening a second browser to look at the versioning shows that we are still on the same version.

    ExcelServicesVersionHistory1

    The changes have been saved to SharePoint, but no version has been created.  Effectively, you can think of this as the same thing as calling .SystemUpdate() for you programmers out there.  However, what I have found is if you wait long enough (a couple of minutes), eventually it will go and commit a new version.  Otherwise, it will commit a new version when you

    ExcelServicesVersionHistory2

    A new version will also be created if you close the document (either close out of the file menu or using the breadcrumbs).  Where it gets really interesting is when you have multiple editors.  You’ll see the same behavior as before, where a new version will be saved a few minutes after the first change.  However, if multiple changes have occurred, it will write the last author’s name into the version.

    ExcelServicesVersionHistory3

    However, ultimately whomever closes their browser session last (or times out last apparently) is the final author of the version.  In this case, Anna closes the document first, then I closed it.  It then goes back and updates the author and modified date on version 4.

    ExcelServicesVersionHistory4

    In summary, Excel Web App will create a new version automatically for you if one hasn’t been created whenever you close the editor or after a period of time has elapsed after the first change.  Whomever makes changes last will end being the ultimate author of that version.  Btw, I have never seen it create a second version of a document when you leave it open for a long period of time.  It appears that it will only create one version for a given Co-authoring editing session.  Hopefully, this help you understand how versioning with Excel Web App works better.  These examples were demonstrated using my Office 365 E3 account.

  • Watch your version numbers with Metalogix Migration Manager for SharePoint

    I was working with a client recently who had purchased Metalogix Migration Manager for SharePoint and I came across an issue that confused me for a minute.  I installed the Metalogix SharePoint Extensions Web Services on a few farms.  However, in the middle of this process a new version of the tool came out and I didn’t realize that some of the farms were running one version while the other farms were running a new version.  I could connect to one farm just fine.  However, when trying to connecting to the other farm (that had the newer version), I received a 404 error. 

    In my round of troubleshooting, I tried reinstalling and redeploying the solution package but to no avail.  It wasn’t until I dug deep into the documentation that I realized that the version number was included in the path to the web service itself.  It was then I realized that the version number of all web service extensions as well as the Migration Manager itself all have to be the same.  If you are using this tool and run into a 404 error, be sure and check those version numbers.

    Note: By writing this, I am not endorsing one particular SharePoint migration product over another.  I work with all of them.  It’s simply the tool being used on this migration.  That means I don’t need any of Metalogix’s competitors calling or E-mailing me this afternoon.  That means you Axceler and AvePoint. :)

  • Speaking at Office 365 Saturday Redmond!

    I’m excited to be speaking at the first Office 365 Saturday in Redmond on 2/25.  This new event will be an exciting display of all things Office 365.  I’ll be talking about all of the cool things you can do with Search in SharePoint Online.  I gave this talk at SPC11, but I gave the talk an upgrade with the use of Visual Studio 11 Developer Preview.  We’ll look at what you can do out-of-the-box with search and then write a custom Silverlight application to query search web services.  If you’re looking to get more out of search be sure to stop by and check out my session.

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