Posts

Get data of all users on the SharePoint with CSOM C#

Sometimes you need to get information abot some user. To do so you need the SiteUserInfoList. This list contains data about all user that visited the SharePoint site. This is how you can read the list with C# and CSOM: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // build the SharePoint connection ClientContext clientContext = new ClientContext( "http://your site/" ); Web web = clientContext.Web; // get the userinfolist List siteUserInfoList = web.SiteUserInfoList; // build a query CamlQuery query = new CamlQuery(); query.ViewXml = "" ; // get the data IEnumerable<ListItem> itemColl = clientContext.LoadQuery(siteUserInfoList.GetItems(query)); clientContext.ExecuteQuery(); // work with the userinformations foreach ( var item in itemColl) { Console.WriteLine( "ID:{0} Email:{1} Title:{2}" , item.Id, item[ "EMail" ], item[ "Title" ]); }

SharePoint 2013 apps - communicate with host SharePoint without using SP.RequestExecutor

In a previous post  I wrote an app to read and write data from the Host-SharePoint. To do this I made use of the SP.RequestExecutor. This class is used to get the permissions for reading and writing data into the Host-SharePoint. But there is a way to skip the authentification and using the URL directly. This makes your code much more beautiful and easy to read. All you need to do is to call a function (_spPageContextInfo.siteAbsoluteUrl). That function returns an URL and makes it possible to communicate with the SharePoint per JSOM and REST.  I also tried to call the URL with the function and make a context with another URL and this does not work. Even the Host-URL does not work. Another disgusting point is that the URL, which is returned by the function, is that it not contains the URL of the app and not of the host. It is a 'hybrid' that begins like the app URL, but ends earlier. 1 2 3 4 var url = _spPageContextInfo.siteAbsoluteUrl; context = new SP.ClientContext(u...

Open Edit View of SharePoint Pages without the "Edit Page" button

In some cases the "Edit Page" button is not visible too make sure no one makes some unallowed changes. This is a nice security hack, but what if you need to edit the page? There is an easy way to open the page in edit mode and that is the URL. Add one of the following extensions to your URL, right after the '.aspx'. To change the public view of the page add this: ?PageView=Shared&ToolPaneView=2 example: http://sp/Pages/default.aspx ?PageView=Shared&ToolPaneView=2 To change a personal view of the page add this (only if it is enabled): ?PageView=Personal&ToolPaneView=2 example: http://sp/Pages/default.aspx ?PageView=Personal&ToolPaneView=2

Read an Exchange inbox with WebServices and C#

In some situations you will need to read mails from mailserver. One of those servers is the Exchange. Reading it is pretty easy with the WebServices. At first you need to add the reference to Microsoft.Exchange.WebServices. After that you can begin to code. All you need are two functions. One to build a connection to the Exchange and the other one to find folder and read them.

get SharePoint Farm ID with PowerShell

If you need to get the ID of your SharePoint Farm, you need to use PowerShell. Getting it is easy you just need to enter the following two commands and the ID will appear. $SPFarm = Get-spfarm $SPFarm.ID

SharePoint 2013 app - get data from the SharePoint

Image
For safety reasons apps are seperated from the SharePoint where they are installed on. Apps are installed on other domains and that is how the seperation works. Apps can't contact the SharePoint, because Cross-Site-Scriptingis blocking it. But there is still a way to get data from the SharePoint and with this way comes a permission concept into the app world. Permissions There is a library, called the Cross Domain Library, that allows to communicate with a SharePoint from app site. This library is aviable on every SharePoint 2013 and is easy to call. But wait.. if it is so easy to call a library that can get SharePoint data it is not saver than before. This library contains more than communication.. it authentificates the app against the SharePoint and asks for permissions. This happens right after the installation of the app. The installing user will be asked to grand permissions for the app. But how does the app know what permissions are needed? Asking for permissions is you...

Basics for SharePoint 2013 app development

Image
The biggest innovation in SharePoint 2013 is the app-architecture. With this innovation it is possible to install applications (apps) on a SharePoint. This applications can be developed by yourself or you can buy them in the SharePoint Store. They are totally detached of the SharePoint and got their own area. They can contain own lists, have own sites with custom code and they have their own interfaces. But it is possible to communicate with the SharePoint. My first app To develop an app you need Visual Studio 2012 or above and a development SharePoint. To begin start Visual Studio as administrator and click 'New project...'. A mask opens where you can choose a template. Go to 'Templates' → 'Visual C#' → 'Office/SharePoint' → 'Apps' and select 'App for SharePoint'.