Radi Atanassov

SharePoint MCM, MVP, MCT and owner of OneBit Software

Deploying and debugging SharePoint Apps – Sideloading the easy way

If you try to deploy an App from Visual Studio to anything other than a developer site you will get this error:

“Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.”

This is due to a feature that is not enabled on any other site template apart from the Developer Site. This error will also occur if you are deploying to a host named site collection that is not at the root of the web application. You will also get this when you are deploying to a site in Office 365 that is not a Developer Site.

You might be developing a solution and you may want to deploy it to a site that is not a Developer Site.

To enable this for on-premises environments, run this PowerShell script:


Enable-SPFeature -Identity AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D–url <siteurl>

To enable this on Office 365 sites you should use the client-side object model. Here is an example:

   1: $siteCollectionUrl = ""
   2: $username = ""
   3: $password = ""
   4: [Microsoft.SharePoint.Client.ClientContext]$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteCollectionUrl)
   5: [Microsoft.SharePoint.Client.SharePointOnlineCredentials]$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
   6: $context.Credentials = $credentials
   7: $siteCollection = $cc.Site;
   8: $sideLoadingGuid = new-object System.Guid "AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D"
   9: $siteCollection.Features.Add($sideLoadingGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);
  10: $context.ExecuteQuery();

The only thing that this feature does is “register” itself as an activated feature on the site. You can check the event receiver, it does nothing but checks.

Here is a piece of the Microsoft SharePoint code that actually checks if sideloading is enabled:

   1:internalstaticbool IsAppSideloadingEnabled(SPSite site)
   2: {
   3:if (site == null)
   4:     {
   5:thrownew ArgumentNullException("site");
   6:     }
   7:return SPDeveloperData.IsDeveloperSite(site) || site.Features[FeatureIds.EnableAppSideLoading] != null;
   8: }

This is performed in the API that VS uses to deploy Apps.

Hope this helps!

Getting search to show search results for social tags and the SocialTagId managed property

 

The SharePoint 2010 “My Profile” page provides some cool social tagging features that intertwine with Search, Managed Metadata and obviously the User Profile Service.

If you click the “Tags and Notes” link you will see a summary of social activity related to the user:

  

You can refine a tag for the particular user, but one functionality that not many people know of is the “Tag Profile” page. You can reach it either from the Tag Cloud Web Part, or clicking on one of the tags in the tag feed on the profile page (see my hot pink arrow in the image above).

You will eventually reach a page with a URL like “…../mysites/tagprofile.aspx?termid=bfcb16ea-cb44-46c4-b8f2-6da2646262c0” and it will look like this:

 

 

What might not seem so obvious to everyone is that the profile page says there are “no available items tagged with…” yet we reached this exact page by seeing what’s tagged by our user :) A bit silly, but there is a technical explanation. The “Tags and Notes” page feeds data from User Profiles social data, while the tag profile requires Search.

 

Now, another extremely obscure link and functionality… the text says “To find content related to ‘[Term]’ in search, please click here.” Well, OK, I think this is the only place I’ve ever seen this link or at least I can’t remember any other places at the moment. Clicking it takes us to some very interesting functionality:

 

 

It will take you to the search center configured in UPA; SocialTagId:"bfcb16ea-cb44-46c4-b8f2-6da2646262c0" will be the search keyword. The syntax suggests that “SocialTagId” is a managed property. Many environments don’t have this particular functionality configured and there is a lot of misinformation on how to configure it.

So here is what you really need to do to get this working in SharePoint 2010:

1) Make sure User Profiles, Search and Managed Metadata are all up and running. You don’t need User Profile sync.

2) Make sure the My Site Host is configured in the farm and:

a. The User Profiles Service Application is configured with the My Site Host url:

 

 

b. The web application containing the My Site Host is added as an “sps3” (or “sps3s”) start address in a content source:

 

 

HINT: create a separate content source for People data so it is more manageable and you could create separate crawl schedules

 

c. The search crawl account (aka Default Content Access Account) has read permissions on the My Site Host. The easiest way to achieve this is through a web application policy:

 

 

3) Configure the search crawl account to have permissions over User Profiles. This step is a bit tricky, you have to click the Administrators ribbon button when your UPA is selected:

 

 

You need to give the account the following two permissions:

· Retrieve People Data for Search Crawlers

· Manage Social Data

 

 

NOTE: this post by Steve Peschka explains why:http://blogs.technet.com/b/speschka/archive/2010/02/22/why-do-i-get-an-access-denied-error-when-managing-user-contexts-in-sharepoint-2010.aspx

NOTE2: Yes, I am using my farm account to crawl content. You don’t need to do this and you shouldn’t, but this is how my demo environment is set up for simplicity.

4) Create some content and tag it with some keywords. To be honest I am not 100% sure this is actually required, but this is generally true for search – it must have content to find its crawled properties before you can elevate them to managed properties.

5) Run the User Profile Social Data Maintenance job:

Get-SPTimerJob | ? {$_.TypeName -match "socialdatamaintenance"} | Start-SPTimerJob

6) Run a crawl that will capture the content you tagged

If everything is OK and the galaxies are well aligned, you will see successful logs in the content source logs:

 

 

(Actually, you might see the above if it hasn’t worked either!)

Then your Tag Profile page will look like this:

 

 

And clicking the tiny “search” link will show you results from Search J The search URL will look like this:

/search/results.aspx?k=SocialTagId%3A%22cc725510-7468-4342-80d6-5c1c9fb27180%22

 

So you may wonder, why would you need this, it doesn’t look that flashy? Well.. You can now query for items with certain tags using search. You can use this in custom rollup functionality scenarios like I need to do in one of my projects. Cool.

Hope this helps someone out!

My slides from the European SharePoint Conference 2013

So, European SharePoint Conference 2013… lots of fun, lots of friends and an absolute goldmine for business contacts.

My session - Building SharePoint 2013 Apps - Architecture, Authentication & Connectivity API – rolled out a score of 8.2/10. Not bad, I even got a mention that it was in the highest ranking talks.

What I spoke about:

  • A quick technical overview of SharePoint Apps, just to set the scene
  • Why we need to consider Apps
  • How Apps “work” inside of SharePoint – the app domain, IIS and DNS, how the Site Subscription Service and App Management Service come into play and what their role is
  • Authentication – How OAuth works with a neat demo in Fiddler
  • Server-2-Server Authentication – How to set up S2S and how it differs from OAuth
  • Token fun – context, refresh, bearer, access tokens and whatever else I could throw in

http://www.slideshare.net/SharePointRadi/euspc-2013-radiatanassov

Unfortunately I didn’t have time for App licensing and REST/CSOM communication.

Another cool galleons galore step for me – I got recognised as the Top Influencer for Bulgaria:

 

Adios!

 

Getting Started with SharePoint 2013 and Office 2013 Application Development

So chances are you’ve heard a  lot of noise around the official launch of SharePoint and Office 2013… Well there is a LOT to it. New App development models, new features and API’s, enhanced capabilities and a ton of improvements. The Apps for Office paradigm is also very slick.

So where do you start?

SharePoint 2013 Developer Training: http://msdn.microsoft.com/en-US/office/apps/fp123626- here you will find a ton of cool videos showing off some new stuff. They even have stuff on Project 2013 development 

 

 Maybe PSI will work this time?

The Office and SharePoint App Development site: http://msdn.microsoft.com/en-US/office/apps- a TON of resources. Some are still being added so you might get some 404’s

The Apps for SharePoint (2013) Overview - http://msdn.microsoft.com/en-us/library/office/apps/fp179930(v=office.15) – definitely one of the best places to start reading up on how SharePoint 2013 introduces a new development paradigm.

Developer downloads: http://msdn.microsoft.com/en-US/office/apps/fp123627 – Expect the official SDK to be released here.

 

Currently rated 5.0 by 1 people

 

Download the SharePoint 2013 (15) Preview

Ive been waiting for this day for a LONG time... The internet is going crazy over the new Office 15 and us SharePoint fans can’t sleep from all the excitement either.

Watching all the online commotion, chatter and reviews is fun, but the best part is trying it out yourself.

Get your hands dirty:

http://www.microsoft.com/en-us/download/search.aspx?q=SharePoint+2013

 

The bits are getting added one-by-one as I am typing this, so there you go.

Also check out the Office 365 CP:

http://www.microsoft.com/office/preview/

 UPDATE: here is the link to SharePoint Server 2013: http://technet.microsoft.com/en-us/evalcenter/hh973397

 

Architecting your SharePoint application–things you shouldn’t miss out on

So a few people recommended I post my slides or content from my European SharePoint Conference session. I cover a list of considerations that makes a good reference for people undertaking the design of custom applications on SharePoint.

Usually in projects you would have people responsible for the design of the infrastructure and then a development team would dig into the technical design of the SharePoint application. They will try to answer how different components will be used to satisfy the requirements. Solution Architects explore various options for meeting each requirement and all these options and choices intertwine into a proposed design, maybe a model or a proof of concept, and hopefully a document. Projects that miss this communication are either chaotic, or extremely agile.

When doing architecture there is usually more than one possible way to achieve the same thing – the “right” one will depend on the situation and each of the things I’m pointing out here could be equally right or wrong. This is especially true for SharePoint. That is why “awareness” and the knowledge of SharePoint are one of the key requirements for an architect to be any good.

This list is not the ultimate list – it is just my summary of what always lands on my table. It is also not the base for a definitive Technical Design document (it’s a start!). Some items below didn’t get mentioned in my talk as time was limiting what I could include.

Front-end Planning

Page Model – How you plan to store you (ASPX) pages

  • Application Pages (_layouts)
  • ASPX files served from a Document Library
  • ASPX files in folders
  • Publishing Infrastructure – page layouts
  • Consider Web Part Pages vs. Wiki Pages

Form Strategy – Consider how you will capture data and what controls/interfaces you will use

  • Understand how SharePoint forms work and consider using SharePoint’s API’s
  • SharePoint InputControls are great but may be difficult to use and may have limitations
  • Consider exchanging data between forms. Plan Session and ViewState requirements
  • SharePoint Scenario Framework
  • Consider validation requirements and the UX on the validaiton
  • Also consider Silverlight and InfoPath forms as alternatives for capturing data

Client-Side Scripting – plan out any requirements for client-side JavaScript

  • If using validation, plan out your client-side scripting and the use of any frameworks
  • Will you use the Dialog Framework or any other popup/dialog framework/toolkit?
  • Consider the use of jQuery, Modernizr, Knockout

Page Components – define what controls, web parts or other components you will use to create the actual interfaces

  • Web Parts vs. User Controls
  • SharePoint Rendering Templates and the Form UI (_controltemplates)
  • Consider the styling/branding of your custom interfaces – you don’t want your developers to be designers (unless they really are)
  • Iframe – various solutions use Iframes to display external content or components hosted elsewhere (plan out authentication)
  • Consume HTML asynchronously – I have seen solutions that grab HTML from an ASHX or other services
  • InfoPath – always think about the User Experience when you deal with InfoPath

Resource Files – evaluate how you will use resource files and what components will require localisation

  • Code-behind resource files
  • ASPX resource files (14\Resources, AppGlobalResources)
  • Feature Resources
  • Localised Web Templates

Back-end Planning

SharePoint Data Model – define the storage of data

Consider:

  • How are you going to store data?
  • How will it scale?
  • How are you going to access it? (SP OM, External Data (BCS), Web Service calls)
  • How are you going to “replicate” it? (backup, archive, move/copy, log)
  • How are you going to store applicaiton settings (SP list, P&P Settings)

Visual Studio Solution Structure – How will you structure code and artefacts

  • Number of WSPs/Number of Features
  • Separation of code
  • Separation of SharePoint items
  • Namespaces and naming conventions
  • Source Control strategy

Design Patterns/Anti-Patterns – make your code maintainable and nice if it makes sense to do so

  • SharePoint Service Locator (P&P)
  • Façade/Adapter
  • Consider/plan your data access layer

Security Model – don’t think about it in production

AuthN:

  • Kerberos/NTLM (consider the requirement for Kerberos)
  • Claims (consider the effort to pull it off and any side-effects)
  • Plan the use of service accounts and access for/to external systems

AuthZ:

  • Use SP groups or AD groups?
  • Nested groups
  • Do you really need item-level security?

Exception Handling and Logging – define how to display/capture errors and how you log them

  • Consider how you will display errors to the user (don’t do lblMessage.Text = ex.ToString(); )
  • Define what needs to be logged and how
  • SharePoint Logger (P&P) gives you a good API for Diagnostic categories and areas

Deployment

Solution Deployment Frameworks – define how your developers will deploy

  • MSBuild
  • NAnt
  • 100% PowerShell
  • CKS-Dev addin  for Visual Studio 2010

Other Knobs and Dials – there are many other things that affect deployment

  • WSP lifecycle
  • Feature activation
  • Activate on Default
  • Deployment configuration
  • WSP additional DLL's
  • Force on Activate
  • Safe Controls
  • Web.config modifications
  • Web Part deployment
  • List re-creation
  • Feature Upgrade

Site Templates – reusable functionality that admins or end users could provision

  • Site Definitions
  • Web Templates

Continuous Integration and Testing

  • Plan and define the CI/Build process
  • Always consider how you will upgrade the solution
  • Define the unit testing and mocking requirements (Pex & Moles, TypeMock)
  • Funcitonal UI Testing (Selenium, Coded UI, Telerik Test Suite)
  • Always sync with the test team and what they do/how they will test your solution

To close off the talk I finished off with a few tips:

  • Build applications in such a way that makes you feel proud of what you have built. Doctors feel good when they help people, architects feel good when their creation is built, lawyers are happy when they get paid – there is no reason why SharePoint developers and architects shouldn’t feel good about what they do if they do it well.
  • Motivate your team to do good work – As an architect you are most likely a role model. Do your best to motivate your team members to be champions and get good stuff out there. Reward them for good efforts.
  • Change your job if your boss/architect/team leader/project manager is pressuring you to do crap work with no process around it, no scope, no clarity, no design, etc. Your SharePoint career is way to short for you to be doing crap work in crap teams. Only you could make that change.
  • Apply development practices and architecture to SharePoint solutions – many say that there is no real development in SharePoint. It’s true that there is a lot of “other stuff” in SharePoint projects, but for the development part – make it count.

Here is my slide deck: SharePoint Solution Architecture – Radi Atanassov

During my talk I showed bits of a solution I use to POC various SharePoint components. I use it to explain and demonstrate things to students, forums and colleagues. I call it Community.SharePoint and as soon as it has a few other key components I will post it on CodePlex.

Here is the version I used at the European SharePoint Conference: Community.SharePoint-EUSPC

Hope this helps someone!

European SharePoint Conference is over!

Now that the conference is over I can finally take a moment and rest before the week starts. #EuropeanSP was a great adventure full of learnings, laughs, new contacts, new opportunities, plenty of fun and drinks. I got to meet many SharePoint heroes whom I haven’t met before and managed to exchange some cool gossip. Conferences like these really demonstrate how much SharePoint has grown not only as a product with features, but as a product with a community, a following, a resource gap and a HUGE market.

My talk was targeted towards SharePoint solution architects and developers who get to design their custom applications. My main driver for picking this topic was questions I get in the fashion of “How do you design your solutions?” or “What do you do when people throw you a set of requirements?”.  I was very happy with the turnout and I got really good feedback from some people.

I will be writing a new blog post with the content, code and slides.

My Session at the #EuropeanSP Conference

I’m at the Estrel hotel in Berlin on the tutorial day of European SharePoint Conference. Most people will be arriving today – you can definitely feel the SharePoint vibe in the air. The Estrel Convention is absolutely HUGE, walking around this place is a calorie-burning experience!

I’m engaged in a few activites:

  • Wednesday 19th October 15:00 – Ask the Expert Session – IT Decision Makers
  • Thursday 20th October 11:15 – Ask the Expert Session – Developers
  • Thursday 20th October 14:00 – Advanced Solution Architecture & Development – my talk for this conference.

Please come and say hello!

I’m presenting a SharePoint Conference Webinar in 4 hours!

 

I just wanted to post up info on a webinar I am delivering as part of the European SharePoint Conference program.

 

I will be talking about SharePoint Architecture, what it is, who are the “architects”, what their challenges are, how they make decisions and how their decisions impact the progress of a project.

 

Join me here:

 

Thursday 8th September, 11am CET

 

SharePoint Solution Architecture - Introduction and Fundamentals Presented by Radi Atanassov, MCM -SharePoint 2010, MVP, MCT, OneBit Consulting, Bulgaria

 

Register Now >>

 

Custom WCF Services and setting Reader Quotas in SharePoint 2010

I’ve been working quite a bit with custom WCF services in SharePoint 2010 and have found there’s quite a bit to it. The part that worries me is that there is a ton of information out there that is not always best for enterprise scenarios, like setting the site in IIS to anonymous just to get service calls working.

Anyway… I was trying to figure out why the reader quota settings weren’t getting applied to our services. We had the following debug code:

  1. SPWebService contentService = SPWebService.ContentService;
  1.  
  2. contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = -1;
  3.  
  1. SPWcfServiceSettings wcfServiceSettings = new SPWcfServiceSettings();
  1. wcfServiceSettings.ReaderQuotasMaxStringContentLength = Int32.MaxValue;
  2. wcfServiceSettings.ReaderQuotasMaxArrayLength = Int32.MaxValue;
  3. wcfServiceSettings.ReaderQuotasMaxBytesPerRead = Int32.MaxValue;
  4. wcfServiceSettings.MaxReceivedMessageSize = Int32.MaxValue;
  5. wcfServiceSettings.MaxBufferSize = Int32.MaxValue;
  6. wcfServiceSettings.ReaderQuotasMaxDepth = Int32.MaxValue;
  7. wcfServiceSettings.ReaderQuotasMaxNameTableCharCount = Int32.MaxValue;
  8. wcfServiceSettings.ReceiveTimeout = TimeSpan.MaxValue;
  9.  
  10. contentService.WcfServiceSettings["MyService.svc"] = wcfServiceSettings;
  11.  
  12. contentService.Update(true);

This was placed in a feature scoped at the web application level, and the WSP was deploying to /ISAPI/CustomWcf/MyService.svc”. We we’re using SharePoint’s MultipleBaseAddressBasicHttpBindingServiceHostFactory factory, and if you are you don’t need to set anonymous in IIS.  This factory applies your security settings as they are on the web application.

So why weren’t our WCF Service settings getting applied? If you check out this MSDN article, it doesn’t actually tell you what I figured out:http://msdn.microsoft.com/en-us/library/ff599489.aspx

The problem is that “MyService.svc” should actually be lower case: “myservice.svc”. It sounds silly, but that is what worked for me. The /CustomWcf/ folder part should be excluded.

If anyone is doing the same, here are a few tips on how such deployment strategy could be improved:

  • The feature should really be at a farm level if it is modifying settings on the Content Service. There is one per farm.
  • Feature Deactivation code should call contentService.WcfServiceSettings.Remove("myservice.svc");
  • You SHOULD NOT just use Int32.MaxValue, but actually figure out your maximums and what exact properties you should apply them on. In my example I’m obviously trying to get a sample to work.
  • Make sure your deactivation doesn’t break any other solution if you are resetting with this line: contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = 0;

Hope this helps!