Posts

Showing posts from February, 2016

SharePoint: How do I get the groups for the current user in Javascript or JQuery?

My current project requires me to identify the persona of the logged in user based on their membership of specific SharePoint groups. The first port of call is to extract all the groups for the current user and then work out what they can do. Sounds easy enough. I tried the following: function getUserGroups(success, failure) { var d = $.Deferred(); var ctx =  SP.ClientContext.get_current(); var collGroup = ctx.get_web().get_siteGroups(); ctx.load(collGroup);                 ctx.load(collGroup, 'Include(Users)'); var currentUser = ctx.get_web().get_currentUser(); ctx.load(currentUser); var o = { d: d, collGroup: collGroup, currentUser: currentUser }; function onQuerySucceeded() { this.d.resolve(this.collGroup); this.d.resolve(this.currentUser); var data = { "collGroup": this.collGroup, "currentUser": this.currentUser }; //return success(this.collGroup); ret...

SharePoint 2010: How do I download a wsp?

I recently had the requirement to move a wsp from one farm to another and the source component was nowhere to be seen. I found a nifty little script  here  that gave me a solution: $farm = Get-SPFarm $file = $farm.Solutions.Item("mycode.wsp").SolutionFile $file.SaveAs("c:\temp\mycode.wsp")

SharePoint: Why is my WEBDAV connection so slow?

Image
Writing solutions using JQuery/Angular/Javascript is great. I use NotePad++ as my IDE and simply update the files on the SharePoint site directly. Using IE, I use the 'Open in Explorer' option in the ribbon and edit the files directly. However, the upload performance on my home PC really sucked. I was uploading a 500 bytes (yes bytes) a second. Painful. The solution was pretty simple; uncheck 'Automatically detect settings' in the LAN Settings .

SharePoint: The language is not supported on the server

My current requires nested sub webs to have a specific language/regional setting. The problem arose when I started changing the Regional Settings from English (US) to English (Australia). $web = Get-SPWeb $siteCollectionUrl $culture=[System.Globalization.CultureInfo]::CreateSpecificCulture("en-AU") $web.Locale=$culture $web.Update() OR       myWeb.Locale = System.Globalization.CultureInfo.CreateSpecificCulture("en-AU"); However, this started to cause problems when users started to create their nested webs. I was using the following C# code to create the webs: var newWeb = web.Webs.Add("Name","Title", "My Web", site.RootWeb.RegionalSettings.LocaleId , webTemplate, false, false); The locale I was referencing (3081) is not installed on the server - only the default 1033. It was trying to create new the site using the regional settings I had set previously. This was a bit of a problem: I need to create  the site and ens...