Posts

Showing posts from 2015

SharePoint 2013 Using relative path in SharePoint master page

There is a few things that you can do if you want to use relative path for referencing an image or file. 1. You can place your images physically in the 15 hive folder under C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\IMAGES (or Layouts location) Place a image here (logo.png) and you can access this image in your masterpage like this 2. Use img tag and you need add  runat="server"  attribute in this tag. <img src=" < % $SPUrl:~SiteCollection/Style%Library/Images/logo.png% > " alt="My Image" runat="server"/> 3. Use this: < a href=' < SharePoint:EncodedLiteral runat="server" text=" < %$SPUrl:~SiteCollection/% > " EncodeMethod="HtmlEncode"/ > ' class="logo" >   < img src='<SharePoint:EncodedLiteral runat="server" text=" < %$SPUrl:~SiteCollection/Style Library/CustomStyle/Images/logo.png%

SharePoint 2013 Search Conversation Result Source

If you're wondering exactly what types of data the Out-Of-The-Box (OOTB) Conversation result source actually returns, here are some information that I gather by performing some simple test. The result source ID for Conversations is 459dd1b7-216f-4386-9709-287d5d22f568. It returns the following types of content Personal Newsfeed posts and replies Newsfeed activity posts are also returned which could it a pain. Activity feed is the post that tells people you posted something on a community site. Discussion board posts and replies from community sites Site feed posts and replies from community and team sites (and probably all sites that enable site feed feature)

SharePoint 2013 - Use JSLink to Create Custom Field Type

Image
One of the things that we used to be able to do with server farm solution is to create custom field type and custom field type control.  With the App Model approach, we'll need an alternative way to give us the custom form that we need. SharePoint is using JSLink for a lot of displaying option.  You can specify a JavaScript to be used in a  web part or for a field.  The example below shows how you can create custom displaying field.  The example do the following: It customize the displaying of the Is Separator field to add onclick event handling if the URL field is the default value, it sets the default value for both the URL and the description text box Sample form Below is the JavaScript sample code and I saved it in isSeparator.js //IsSeparator Display (function () {     // Create object that have the context information about the field that we want to change it's output render     var isSeparatorFieldCtx = {};     isSeparatorFieldCtx.Templates =

SharePoint with Angular

I have been working on a SharePoint Intranet project that uses AngularJS. Here is some code sample for using Angular with SharePoint.  The sample code below basically is: Getting a items from a list Searching for items with Title containing "Test" Display the results from the list and search onto the page I have the following files appFactory.js - for handling the services call to SharePoint using both JSOM and REST app.js - the main application logic (including a custom directive) list.html - the html template for my directive The files contain are pasted below. ***appFactory.js********************************* var spServices = angular.module('spServices', []); //Factory with SharePoint call using JSOM spServices.factory('SPRestSearchFactory', ['$resource',   function ($resource) {       return $resource(_spPageContextInfo.siteAbsoluteUrl + "/_api/search/query/:searchtext", { searchtext: '@querytext' }, {  

SharePoint Feb 2015 CU causes managed metadata service issue

Image
After applying the Feb CU to SharePoint DEV environment, a few development VMs are having issues with managed metadata services.  Most of the VMs, experience issues on the My Profile Edit page where all the term set properties are getting the following error: There was a problem retrieving data for this field.  Updating values in this field is disabled temporarily.  You can still update values in other fields. Also, if you're trying to enter a hashtag when posting a newsfeed, you'll get The tagging service is currently unavailable, Please try again later. After some investigation, our infrastructure guys figuring out the solution to fix it.  You have to do the following: 1.        Open a Command Prompt window using Farm account and at the command prompt, type:   cd /d %commonprogramfiles%\Microsoft Shared\Web server extensions\15\BIN   2.        Fix the permissions on the server by entering the following command:   psconfig -cmd secureresources   3.        Restar

The server was unable to save the form at this time. Please try again

I was troubleshooting a production issue about permission.  The scenario is as follow.  We have the following team site structure Team Site A Team Site B User A doesn't have permission to Team Site A or B except permission to manage a list in Team Site B.  So, User A only has Limited Access Permission for Team Site B.  By default, it should allow User A the ability to contribute and add item in the list.  However, User A is getting the following error: "The server was unable to save the form at this time.  Please try again". After some investigation and research, I figured out it was because the feature, Limited access lockdown mode", was enabled. ViewFormPagesLockDown(Restrict Limited Access Permissions) Site 7c637b23-06c4-472d-9a9a-7c175762c5c4 Prevents members of the Limited Access role from viewing forms pages and accessing APIs remotely. When this feature is enabled, users with only limited access will not have permission to use remote

Delete Term Group using PowerShell

Below is a script that I used to delete a term group and all the term sets within that group. $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'} if ($snapin -eq $null) {   Write-Host "`nLoading SharePoint Powershell Snapin`n"   Add-PSSnapin "Microsoft.SharePoint.Powershell" } function DeleteTermGroup { $centralAdmin = Read-Host "Central Admin Url:" $termstoreName = "Term Store Name" $groupName = Read-Host "Group name" $site = Get-SPSite $centralAdmin $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site) $termstore = $session.TermStores[$termstoreName] $group=$termStore.Groups[$groupName] $group.TermSets|foreach{ $_.Delete() $termstore.CommitAll() }     $group.Delete() $termstore.CommitAll() Write-Output "Deleted $groupName" } DeleteTermGroup $input = Read-Host "Enter any key to exit" Exit

SharePoint 2013 - Get Variation URL using JSOM

From the variation information on this blog, http://blogs.technet.com/b/stefan_gossner/archive/2011/11/21/sharepoint-variations-the-complete-guide-part-6-configuration-internals.aspx, I used the following code to get the corresponding variation URL to create the toggling button for a publishing site. Type.registerNamespace('spapp'); var context; spapp.url = "https://rchen.sp.com"; spapp.language; spapp.languageHome; spapp.curPageUrl; spapp.relationshipList; spapp.relationshipItems; $(document).ready(function () { var toggleHtml = ' Toggle '; $('#RibbonContainer-TabRowRight').prepend(toggleHtml); SP.SOD.executeFunc('sp.js', 'SP.ClientContext', spapp.init); }); spapp.init = function(){ context = new SP.ClientContext(spapp.url); }; spapp.toggleLanguage = function(){ spapp.curPageUrl = _spPageContextInfo.serverRequestPath; spapp.language = _spPageContextInfo.currentCultureName; spapp.relationshipList =