Roland Oldengarm - Independent IT Contractor

Living in the coolest little capital Wellington, New Zealand!

Category: SharePoint (page 2 of 4)

Angular ADAL JS + SharePoint REST API in non-root site collections

I’ve been struggling with the following. I’m building a SPA Office Add-in, which communicates with Office 365, using the (awesome) ADAL JS libraries. My app queries the SharePoint Search and downloads files.

As a starting point, I’ve been using this example: https://github.com/OfficeDev/O365-WebApp-MultiTenant

To access the REST API endpoints I was using Angular $http, so I don’t have to worry about adding access tokens to the requests. It was all working fine, until I wanted to access files in non-root site collections. I saw a HTTP/401 in Fiddler, but the access token was attached, so that seemed weird. The response was:

{“error”:”invalid_client”,”error_description”:”Invalid audience Uri ‘{azure_app_id’.”}

… where azure_app_id is my Azure Application ID.

Continue reading

How to correctly log search results clicks by calling RecordPageClick in custom HTML & using SharePoint Search REST API

Scenario: Office 365, we have implemented an autocomplete search experience where search results pop up automatically when the user starts typing. We use jQuery autocomplete, and fire Search REST API queries every time a user types something. For different blocks we fire multiple queries, i.e. one for search suggestions, one for people search, and one for files / content.

This is all working like a rocket, but then we ran into the issue that search result clicks won’t be logged. That means that i.e. a search query does not get promoted to a search suggestion when a certain query has received 6 result clicks.

Continue reading

Presentation: Improving SharePoint Search

I’ve presented at the SharePoint User Group in Wellington.

A common mistake with SharePoint Search implementations is that hardly any effort is put into configuring search. Search engines like BING and Google are maintained by large implementation teams and so should an on-site SharePoint search engine receive attention. Query rules, display templates and result types are some of the new features available which will be discussed and demonstrated.

Unfortunately the presentation is not available for download.

SPSiteDataQuery: The property Query contains an invalid value.

Just ran into the following issue: created a big query, which was working fine. Made a minor change and ran into the following exception: The property Query contains an invalid value.]

 [SPException: The property Query contains an invalid value.]    
Microsoft.SharePoint.SPSiteDataQuery.ReportInvalidProperty(Exception ex, String strProperty) +118    
Microsoft.SharePoint.SPSiteDataQuery.ValidateXmlProperty(String strXml, String strPropertyName, String strTag, String strTag2, String strTag3) +366    
Microsoft.SharePoint.SPSiteDataQuery.get_ViewXml() +203    
Microsoft.SharePoint.SPWeb.GetSiteData(SPSiteDataQuery query) +394

This error normally indicates you made an XML-error, like not closing a <FieldRef>. That was not the case. I logged all query-parameters, copy-pasted to PowerShell and it was working like a charm there.

After spending hours I noticed that the Query-parameter started with a whitespace! After removing that, error was fixed…. So, no enters and/or white space at the start of the Query-parameter. It doesn’t matter how many you have inside the query, but nothing at the start.

Error deploying BDC feature

When deploying e.g. an external content type through a feature, everything could look fine on your development machine. However, when installing on another server, you could run into the following error:

Error occurred in deployment step ‘Add Solution’: The default web application could not be determined. Set the SiteUrl property in feature “your feature Name” to the URL of the desired site and retry activation.

Parameter name: properties

Continue reading

Programmatically enable rating on SharePoint 2010 sites

If you want to enable the new Rating feature in SP2010 through your custom webtemplate, you have to do two things:

Add site collection feature to your onet.xml (<SiteFeatures>):

<Feature ID=”915c240e-a6cc-49b8-8b2c-0bff8b553ed3″ />

Add these two site columns to your content type:

<FieldRef ID=”{5a14d1ab-1513-48c7-97b3-657a5ba6c742}” Name=”AverageRating” />
<FieldRef ID=”{b1996002-9167-45e5-a4df-b2c41c6723c7}” Name=”RatingCount” />

On lists where this content type is bound, the Classification setting will also automatically go to Yes 🙂 It only checks whether these two columns are available.

ContentIterator : SPQueryThrottleException

When querying a list with more than 2000 items, you can use the ContentIterator class which should eliminate the SPQueryThrottledException.

Don’t forget one thing: Add the columns in the WHERE-query to the indexed columns. If you don’t do that, you will still get a SPQueryThrottledException

Edit: We found out that indexed columns where not the solution either, because SharePoint throws the SPQueryThrottledException when trying to build up the indices….

We finally solved all problems by just iterating through all list items and doing our things. We could not find a proper solution, let me know if you managed to find one!

SharePoint 2010 custom masterpage: Ribbon disappearing?

Case: custom masterpage, moved around the ribbon, site actions, etc. Testing: clicking on ribbon tabs hides ribbon totally.

Continue reading

Page Layouts in Master Page Gallery not updated after a deployment

The problem: Visual Studio 2010 solution, modules with Page Layouts, etc. Changes in Page Layouts were not updated after deployment. Old version kept on showing up.

Continue reading

Elements of type ‘WebTemplate’ are not supported at the ‘Farm’ scope

I tried to create a web template from scratch through Visual Studio 2010. This article explains it in full detail. After creating an empty element, adding it to a feature, I got the following error:

Error occurred in deployment step ‘Add Solution’: Elements of type ‘WebTemplate’ are not supported at the ‘Farm’ scope. This feature could not be installed.

Continue reading

Older posts Newer posts