Wednesday, September 17, 2014

SharePoint CustomAction Features can be used for 3 things

Well I have a very short post because I want to note this simple fact in SharePoint customization.

Custom Action features (CustomAction XML element) is used with for both ribbon actions, site settings page section and I think list item context menus. The naming matches directly for ribbon buttons and context menus but not as much for site settings section.

And all you need to do is set the attribute Location="Microsoft.SharePoint.SiteSettings" in the CustomAction element, to have it as a site settings action. To create an item for the ribbon set Location="CommandUI.Ribbon"

Example Elements.xml of a feature:

       Id="GroupName1"
     Location="Microsoft.SharePoint.SiteSettings"
     Title="Configuration Section Title"
     Sequence="1"
     Description="blah blah"
     ImageUrl="/_layouts/Images/STSICON.GIF"
    />

      Id="customActionID1"
    GroupId="GroupName1"
    Location="Microsoft.SharePoint.SiteSettings"
    Description="LinkName"
    Title="SharePoint custom configuration page (application page)"
    Rights="MangeWeb"
    ImageUrl="/_layouts/Images/STSICON.GIF">
   
 

Thursday, August 7, 2014

Developer doing administration because of SharePoint

Even if you are on the code side of things, i.e. a programmer, you are exposed to consider a lot of things that usually belong to the administration and the infrastructure domains because a lot of what you need to use as a develop in SharePoint, relies on things that are configured by administrators.

One first initial example is that SharePoint must run within a domain, this means that you will need to create a server with Active Directory Domain Services, called ADDS. This server is called the domain controller.

Virtually everything else relies on administration related work. If you want to configure search, you will need the administrator to create a domain account for the search service. In my company developers do not have administration rights, so they must ask the administration team's help. If they are busy or not even convinced that you should do what you want to do (even on a test server), then you're out of luck. I wonder where is my negotiation skills?! Anyways, that was so annoying for me that I decided to create my own environment on my machine. Luckily I had 16GB of physical ram and an SSD. Not bad and could be used for testing purposes.

Windows Server VM, SQL Server, Domain Controller with a static IP, internet connection? Etc..

As someone whose administration skills are "me can creates adhoc network" this opens up a whole new world for me. I am learning a lot of curious things.

Wednesday, August 6, 2014

Restoring deleted Site Collections in SharePoint 2013

Useful MSDN resource: http://technet.microsoft.com/en-us/library/ff607925(v=office.15).aspx

I just learned what's the identity of a site. At least according to what Restore-SPDeletedSite knows.

This PowerShell SharePoint command is the only way to restore a deleted site collection. In SharePoint 2013 there is no UI in central administration, or even SharePoint designer as far as I have searched that allows you to do this.

To get the list of Site Collections that were deleted and are restorable, use the Get-SPDeletedSite command that will return SPDeletedSite objects.

For example (on a test server, hence http not https) gets you the following information:

WebApplicationId   : 9fa68842-c64d-493b-8102-15d4929d2fb6
DatabaseId         : dcacbbf9-719b-41b7-b7f9-526bce8100ff
SiteSubscriptionId : 00000000-0000-0000-0000-000000000000
SiteId             : b1110b1f-822b-4d70-aace-09dcba30aeca
Path               : /sites/test3
Scheme             : Http
Url                : http://msesrv30/sites/test3
DeletionTime       : 8/6/2014 8:05:41 AM

But which one of these is the site's identity? Sometimes, or a lot of times depending on how new your are to SharePoint, the terminology that is used is confusing. Anyways after a few tries someone realized that they can use the site Path as the identity while invoking the Restore-SPDeletedSite PowerShell command.

Don't forget the preceding forward-slash (/). Using sites/test3 will not work in this example.

Restore-SPDeletedSite -Identity /sites/test3

Wednesday, July 30, 2014

Complexity Management and Software Development

The details are endless, and are of the lowest business value and complete irrelevance.

One of the primary functions in the business layer of a software system uses a generated control structure. Who cares?

All those helper methods, the similarities in the code, the necessity to handle all the errors, all the different data types, the different sources of information, the conversions between the various representations, etc.

Software Development teaches developers to management complexity which is what business management is all about.

From the code's perspective, we don't care if this object denoting a person is a chief operator or a junior operator. It's just a person whose id must be entered in this field and associated with another object that is in turn associated with an period of time.

From the business perspective, we don't care if this is an object or a magic potion. I don't care that the method that processes a chief operator is exactly the same as that of a junior operator. All I care about is that I can choose both and that the system marks them as unavailable for more work, until they finish.

This is what I love about my current job. I must care for both the business perspective and the lowest levels of code details.


Wednesday, July 9, 2014

Exception from HRESULT: 0x80131904 Caused by missing LookupID="True"

I was running the following query when I unexpectedly got this cryptic error: Exception from HRESULT: 0x80131904.


 
   
     
       
        11
     
   
 
  1


PersonFieldName person/group field cannot be compared directly to the integer value 11. This somehow caused the error message which certainly does not indicate anything related to the actual mistake that I have made. One must indicate that we want to compare the Id of PersonFieldName in the FieldRef element, to the integer value in the Value element. We do that simply by adding the attribute LookupId and set its value to "TRUE" as follows:



Why didn't someone just throw new InvalidOperationException("Cannot compare field of type Person/Group to integer value.");

What's more interesting is that this very same error message seems to appear when other kinds of problems occur. Looks like some part of SharePoint's code is missing proper exception handling. See this blog post about receiving the same error message for memory capacity problems!

Saturday, June 28, 2014

IE Compatibility view to add complications to web design

This is interesting and shocking at the same time. Why would IE 9 for one user display your site incorrectly while for another displays correctly?

Compatibility View. This "Feature" let's your modern browser behave like a really old one, this is useful depending on what mental illness you have.

Anyways, psychological problems aside, it is not just that your IE 8, 9, 10 or 11 might suddenly behave like the IE 7 that you no longer support, and as thus have users who enable the view acceidentally have bad user experience with your site, it is not even as simple as that.

When I discovered that my design was not working for some users because of compatibility view, I started to investiage and found out the following MSDN article: http://msdn.microsoft.com/en-us/library/cc288325%28v=vs.85%29.aspx

The article mentioned that:
In Windows Internet Explorer 9 and earlier versions, quirks mode restricted the webpage to the features supported by Microsoft Internet Explorer 5.5.

So we also have Quirks Mode, which occurs when you omit the HTML page's DOCTYPE, to add complexity to your web design life (ON IE!). Unfortunately a significant percentage of my audience uses IE 9 for my current project.

This is why I had to use x-ua-compatible and set the supported IE browsers like so:



This means, I support Edge (shouldn't I?!), if Edge is not available, then I support IE 10, if that's not available then IE 9 and so on... This will disallow the user to incorrectly turn on "In"compatibility view. And this will ease testing as you can rest assured that what you see on your modern browser is that same as what your beloved client will see.