Posts

Showing posts with the label SharePoint Online

Get user information SharePoint using REST Api

Hi, While working on a requirement, I encountered a scenario where I need to show welcome pop up to the first time users. First time user, SharePoint does not provide any api or any solution which gives information about users who logged on first time on your web site. I have documented the whole solution on some other post( Add welcome pop up for first time users of your site using AngularJs Material ) But this post I only want to scope it to retrieve information of logged on user. Information mean current user's accountId, First name, Last name, Email and other required details. I am only talking about client side code here i.e. using REST api or SP default APIs. Below are the various ways to get the property of current user who is logged on to SP site. There are many ways to achieve this requirement but I prefer to use SP.UserProfiles.PeopleManager Api to get it. It gives us vast option to retrieve any user information. Here are some details of getting various details: Ge...

Add welcome pop up for first time users of your site using AngularJs Material

Image
Hi Guys, We really do only have one chance for putting a first impression for end users on our website. User's will never land back to your website if there is nothing interesting found on web site. Same logic works for SharePoint sites too. When a visitor lands on your site for the first time (and maybe the last), how you welcome them will have a big impact. This can be accomplished with pop-up boxes, fullscreen welcome mats, live chat invitations, and more. This post is all about a welcome popup on SharePoint site. In brief, I try my best to provide very easy solution of showing welcome pop up. Requirement:  One of my recent project client asked to show a welcome message. Server side webarts are not promoted by out clients because our site was built in SP online. It sounds very easy but complication added by showing this pop up only once per user. Solution : As a solution, i suggested to achieve this using Content editor web part. Just place some quick JS code on the land...

Reassign a workflow task - Task update was not accepted. To edit a task associated with a workflow task process, you must be the person to whom the task is currently assigned.

Image
Hi guys, Recently one of my client has faced this issue while reassigning a task of default Approval workflow. Here is the screen shot:        SharePoint by default only allows the assignee to re-assign the task. If you try to re-assign a task that is not assigned to you, you get the following message: Task update was not accepted. To edit a task associated with a workflow task process, you must be the person to whom the task is currently assigned. Solution To overwrite this behaviour: Open SharePoint Designer Open the Workflow you wish to modify. On the step where you start the workflow task ‘Start <workflow task name> process on Current Item with…’, right click on the task name. Select Properties and look for the attribute  TaskProcessOwner . Click on the ‘ … ‘ button to select a group or specific user. You may wish to create a SharePoint group specifically for this purpose. All members of this group will have permissions to re-assign tasks that are assigned t...

SharePoint Online/2013 Replace no results default text ‘Nothing here matches your search’ from search results web part

Image
  As we all aware, SharePoint search have great potential to provide very powerful search solution. Couple of new webparts are added in SharePoint 2013, like Content Search web part for which I should use rather a word "Smart" search web part. With a new rendering mechanism, content search webpart becomes more and more simple to edit and customize. That mechanism is called "Display Templates" and these are based upon simple Json to HTML templates. I recently has faced a project scenario, where I was asked to replace the part of search result web part and I provided a solution by updating search display template. Requirement:   When we add a search result web part on any result page along with a search text box web part to enter search keywords. Search results will be displayed in web part if keyword matches any text. When we add both these web parts on page and before entering the search term also the results web part show  “Nothing here matches your search” (as sho...

SharePoint CSOM for beginners: Get Current User details

Image
Hi Guys, This blog is targeted to developers who are novice to the client side object model in SharePoint. SharePoint apps by default provides a basic stub for getting user details inside app. But sometimes it is required to add client side code in simple script file to get user information. I hope this information will also be helpful starters of client side object model. Pre-requisites: 1) Any version of SharePoint installed: SP 2013, SP 2010 or SP Online 2) A web application and a root site collection inside it. It does not matter whether site is team site or any other type of site.(Note: In case of publishing site you need to enable sp.js file loading ). 3) SharePoint Designer installed. Step I : Create a custom script file A script file is required in order to place CSOM code to be executed. Well, here depending upon usability user can chooses any one of these two locations to create this file: - List or Style library : It will be hard to update script file if it is placed under s...

SharePoint get followed sites using REST Api

Image
Recently I was tasked with a project requirement that the user should be able to see list of content he/she followed. To me this sounds much like using the following feature of SharePoint 2013 which allows you to follow documents, sites, people and tags. Also, we don’t want the user to navigate to his/her mySite and have a look on to the content followed. We can use the SharePoint 2013 Representational State Transfer (REST) service to do the same tasks you can do when you use the .NetCSOM, JSOM. Here I explain how to retrieve the site name and URL followed by the current user in SharePoint 2013 using a client object model (REST API and JavaScript) and displaying it in the SharePoint page. 1. Create a new page and a Content Editor Webpart (CEWP). 2. Edit the web part that was added to the page. 3. Upload your text file script into the site assests and copy the path of the text file and paste it into the Content link in CEWP. 4. Output Code The following example shows how to retrieve a...

Send message to client app part using a "PostMessage Shim"

Image
In this post, I’ll walk through how to use the postMessage api to enable cross-frame communication between your Client App Parts and the hosting SharePoint page, to make your SharePoint App Parts more dynamic and responsive to changes in the parent page. Overview In the SharePoint 2013 App Model, Client App Parts are implemented as iframes into pages hosted in App Webs or Provider Hosted web applications. Because SharePoint apps are hosted on different domains, the iframes can’t use javascript to access the parent window and get information from the hosting page. This is a good thing. You wouldn’t want a Client App Part that you installed from the marketplace to be able to see the list of customers on that List View web part that sits right next to it on the page. But it does make it very hard as a developer to give Client App Parts more dynamic page information to work with. The only contextual info a Client App Part can get is through Client App Part properties. Normal SharePoint Web...