Tag Info

New answers tagged

0

In CSOM you could utilize the following method to resolve ClientContext by request Url: public static class ClientContextUtilities { /// <summary> /// Resolve client context /// </summary> /// <param name="requestUri"></param> /// <param name="context"></param> /// <param ...


2

The following method demonstrates how to resolve ClientContext by request Url: private static bool TryResolveClientContext(Uri requestUri, ref ClientContext context, ICredentials credentials) { var baseUrl = requestUri.GetLeftPart(UriPartial.Authority); for (int i = requestUri.Segments.Length; i >= 0; i--) { var path = ...


1

I think we have to load the web object first, before you retrieve any lists from it. Follow the example from MSDN (paraphrased) : function deleteList(siteUrl) { var clientContext = new SP.ClientContext(siteUrl); var oWebsite = clientContext.get_web(); this.listTitle = 'Project Documents'; this.oList = ...


0

Client Object Model doesn't provide versions property (which is available only on Server Side Object Model) I believe your only hope is to rely on the web services SPservices to retrieve version history of items in SharePoint List 2007?


0

A search for the same answr brought me to your (old) question. I found the answer and thought i'd share it with you. I code in VB.NET and i converted my code to your C# syntax. Replace your problem area with this code. That should probably do the trick. File pfile = clientContext.Web.GetFileByServerRelativeUrl(xfile); pfile.CheckOut(); ListItem li = ...


0

You can follow the normal pattern try { ... } catch (Exception) { //Get error code and act } finally { ... } Here is a nice blog which explains Problem with this try/catch/finally approach How to use ExceptionHandlingScope? Comparison


0

As @Bil mentions, ItemId can be retrieved using Url tokens. However, I would like to differ on this statement Wouter's answer to use the query string works but it requires you to poke into the query string for the page and there's no native Javascript function to do that so you're parsing the window.location.href value. I have tested below two ...


2

string siteUrl = "http://MyServer/sites/MySiteCollection"; ClientContext clientContext = new ClientContext(siteUrl); Site collSite = clientContext.Site; RecycleBinItemCollection collRBI = collSite.RecycleBin; clientContext.Load(collRBI); clientContext.ExecuteQuery(); Try the above code. Make sure the current user can see the Recycle Bin by opening it in ...


0

My problem was that I was not re-setting the credentials for the new ClientContext, so I just needed to do: newContext.Credentials = credentials; After doing that, it worked fine.


0

How to exclude "system" folders using SharePoint CSOM Folder class exposes Folder.ListItemAllFields property that specifies the list item associated with the folder, for "system" folders the corresponding list item does not exist. The following example demonstrates how to verify whether the folder is regular or "system" folder: bool regularFolder = ...


0

@Nadeem Yousuf is correct. You should escape it using either double quotes or by using \ Here is a little function you can use for that function escapeApostrophe(title) { title = title.replace(/'/g, "''") return title }


1

Use two quotes. That is 'Shekar''s.pptx'


0

You should be able to create a context for a subsite, just by using subsite's url. Since you say that it is a newly created site, maybe it hasn't been fully provisioned yet and hence you get the error. Can you reproduce the behaviour on another subsite or on the next day with the same one? Can you access the site via GUI? Can you try just the steps below? ...


1

Below are provided some corrections, fixes and considerations for your code: 1)The condition if (file != null) is incorrect since it could not be used to determine whether file exists or not. The following example demonstrates how to verify whether file has been loaded: SP.File file = Context.Web.GetFileById(documentGuid); Context.Load(file); ...



Top 50 recent answers are included