30

For those who are still looking for the answer. SharePoint 2013 (since SP1 at least see UPD below) contains special method Web.GetList. It accepts site-relative url for the list, i.e. site/dev/lists/mylist. Sample code for .NET object model: var ctx = new ClientContext("http://sp2013dev/sites/dev"); var list = ctx.Web.GetList("sites/dev/lists/Addresses"...


29

This seems to be pretty close in performance: context.Load(lists, all => all .Where(l => l.RootFolder.Name == "MyListUrl") .Include(l => l.Id)); context.ExecuteQuery(); list = lists.Single(); If you need to get this by server-relative url you would need to parse the web url and list url first.


26

My observations (answers at bottom): If this is too long then just read the headings Developer => Accept change If you want to stay calm and not have your world changed all the time, then maybe a job as a Software Developer isn't the right for you unless you want to maintain old legacy applications. Cobol hasn't changed much lately. Companies/Application ...


23

Here's a better way than the code from John by using plain JavaScript (no need for jQuery) and without adding the element to the body manually: var element = document.createElement('div'); element.innerHTML = 'Hello World, I am the dialog content'; SP.UI.ModalDialog.showModalDialog({ html: element, title: 'My Dialog Title', allowMaximize: false,...


21

You should use SharePointOnlineCredentials that handles all the handshaking, claims and oauth in SharePoint online. using (ClientContext clientContext = new ClientContext("https://innergen.sharepoint.com/sites/mydevsite")) { SecureString passWord = new SecureString(); foreach (char c in "yourpassword".ToCharArray()) passWord.AppendChar(c); ...


21

For a CSS-only approach, add the following CSS inside a Content Editor web part or add it to your custom CSS. Remove the <style> tag as necessary. <style type="text/css"> /* tile row height */ div.ms-promlink-body { height: 100px; } /* tile dimensions, including inter-tile margin */ div.ms-tileview-tile-root { width: 110px !...


18

Yet another version to load List by server relative Url using CSOM. The solution consists of the following steps: Retrieve list Folder object using Web.GetFolderByServerRelativeUrl method Retrieve List by specifying List ID stored in vti_listname property from Folder.Properties object Code: static class WebExtensions { /// <summary> /// ...


17

So, I'll wade into this discussion. Apologies for the wall of text. Some background - I was a developer in CMS 2001/2002 before we joined the SharePoint group in 2003. I've build on top of the core SharePoint codebase as part of the publishing features, taxonomy, etc. I'm super familiar and comfortable with server solutions and how to extend SP on the ...


16

I see two differences one difference: The function SPContext.Current.Site.OpenWeb() creates a new instance of the SPWeb object, and you are responsible to dispose it. However, SPContext.Current.Web gives you access to the current instance of SPWeb, and you must not dispose it. The function SPContext.Current.Site.OpenWeb() (without sending parameters) opens ...


16

Immediate Alerts timer job "Sends out immediate and scheduled alerts." the documentation says. However, immediate is controlled by a timer job which runs every five minutes by default. So in your case - the possible series of actions is: Create folder Create alert Now these two actions happened within the same 5 minute period, and when the timer job fires ...


16

Yes, your trouble is quite understandable! First, you should read that "controversial" discussion we had here a few days ago: SharePoint development past and "future": how to keep calm?. This will give you a history/backgroung about the different dev approaches for SharePoint. And here's another (more technical) overlook: Farm solutions (aka ...


15

Fun stuff, I was checking this site since I stopped answering SO SharePoint questions for a few years now and this was the first thing in the list, a very interesting oversight during the "host web Feature" option for CustomActions. What a detailed investigation! Luckily I have a solution for you. WEB STANDARDS TO THE RESCUE CHO CHOO With Microsoft ...


15

There are a couple of methods for this available in the object model without the need to handle the slashes etc yourself, one method using MakeFullUrl: var fullUrl = item.ParentList.ParentWeb.Site.MakeFullUrl(item.ParentList.DefaultDisplayFormUrl); Parameters strUrl Type: System.String A string that specifies the server-relative URL. ...


15

Client-Side Rendering is simply a term for when the data is transformed using the client rather than the server. This means using client-side technologies, such as HTML and JavaScript. It allows us to style SharePoint elements using JavaScript, rather than having to write XSLT. You can use it to style complete List Views, Fields, Search Results and more. ...


13

You can do it in Singleline of code var siteCollectionURL = _spPageContextInfo.siteAbsoluteUrl;


13

You can do the following: var options = { url: 'https://sp2013dev/sites/dev/Shared%20Documents/Forms/EditForm.aspx?ID=9', title: 'My Title', allowMaximize: false, showClose: true, width: 400, height: 350, dialogReturnValueCallback: function(result){ if (result == SP.UI.DialogResult.OK) { window.location....


12

If you use the commandlet Get-SPDatabase there are several properties of the returned object that can give you the information you need. $db = (Get-SPDatabase)[0] $db.Server Will print out the full server name, and I would assume instance, for that database. Another interesting property would be $db.DatabaseConnectionString That will print out something ...


12

The only way I could get the selected value of a dropdown choice column was with the following: SPFieldChoice dropdown = item.Fields.GetFieldByInternalName("AdminGuide") as SPFieldChoice; string selectedValue = dropdown.GetFieldValueAsText(item["AdminGuide"]); Thanks RJ and PirateEric for your comments!


12

I normally follow as below SP.SOD.executeFunc('sp.js', 'SP.ClientContext', readyFunction); function readyFunction() { getCurrUser(); evalGroups(); getDeptMgrs(); getItemOwner(); } Its more readable!


12

Probably it occurs since you are using App-only policy type for authorization . According to App authorization policy types in SharePoint 2013: App-only policy—When the app-only policy is used, SharePoint checks only the permissions of the app principal. Authorization check succeeds only if the current app has sufficient permissions to perform the ...


12

You can refer below sample: ClientContext context = new ClientContext("http://SiteUrl"); List listObj = context.Web.Lists.GetByTitle("ListName"); ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation(); ListItem newItem = listObj.AddItem(itemCreateInfo); newItem["Title"] = "My New Item!"; newItem.Update(); context.Load(newItem);/...


12

Felt my way around this, I found that context.Load(file) , context.ExecuteQuery(), was needed to actually load the file, and then I need to proceed into putting it in a stream which I later turned into a byte array which I was able to convert into base 64. public static void GetImage(ClientContext context, string uri) { try { var files = context.Web....


11

In short, there's another web.config file in the LAYOUTS folder in the 14 hive that you need to change, it's set out fairly well here: http://web.archive.org/web/20130909002813/http://www.khamis.net/blog/Lists/Posts/Post.aspx?ID=12


11

The correct format for the Rest API POST Search Query is: {'request': {'__metadata' : {'type' : 'Microsoft.Office.Server.Search.REST.SearchRequest'}, 'Querytext': 'query'} } I found an example here in the second image.


11

Use a lambda expression like below, For one item clientContext.Load(user, u => u.Title, u => u.LoginName); For a collection ctx.Load(items, i => i.Include(f => f.Id, f => f.Title)); See here https://www.itunity.com/article/loading-specific-values-lambda-expressions-sharepoint-csom-api-windows-powershell-1249


10

You need to get the values into a collection object and then iterate through them and test it it is a group, if not assume it is a user, as follows: SPFieldUserValueCollection objUserFieldValueCol = new SPFieldUserValueCollection(web, listitem["UserGroupField"].ToString()); for (int i = 0; i < objUserFieldValueCol.Count; i++) { SPFieldUserValue ...


10

You have several options for your type attribute in your value element. You can use Boolean, Choice, Currency, DateTime, Guid, Integer, Lookup, Note, Text, User. These type attributes are required, and can't be omitted. As regards to performance, CAML itself is faster than say LINQ, which at first need to be converted to CAML and then query the database. ...


10

Run this code. I have taken "filename" as a folder - you can replace it with any folder name that you want. ClientContext cxt = new ClientContext("http://win-8c97ll22qqc:100/sites/dev"); List list = cxt.Web.Lists.GetByTitle("Documents"); cxt.Load(list); cxt.Load(list.RootFolder); cxt.Load(list.RootFolder.Folders); cxt.Load(list.RootFolder.Files); cxt....


10

You cannot fetch the List items more than threshold limit. Ex: you have 10,000 items, there are 3000 item which meets your caml expression. you may think this is less than threshold limit, so it will retrieve. but here it won't retrieve rather you will get exceed threshold limit exception. What you can do is. You fetch all the items/documents 10,000 and ...


9

As James mentions it's not a valuable comparison as it's two completely different tools. No "SharePoint is not a database" and no "SQL is not a collaboration, document management, ... platform". But to answer your question only point 7 and 8 has been changed (fixed) in SP2013. For more information: Here is my take on the eight points: Primary and foreign ...


Only top voted, non community-wiki answers of a minimum length are eligible