Client object model in SharePoint 2013
Hi,
I have installed .Net 2012 and want to create one client object model .But SharePoint is not installed in my system.So how i will get the SharePoint templates in the .net and how i am able to do this.
Please help
Thank you
Hi,
Thanks for reply.
But i am working in client machine and i have to create app using client object model and i have no access to the server.
As per your answer, you want say i have to install SharePoint in my client system ?
Then only i get the sharepoint templates in the .Net ?
Similar Messages
-
Advantages and Disadvantages of Client Object Model in sharepoint 2013
I need Advantages and Disadvantages of Client Object Model in sharepoint 2013
like below in javascript. Users will have read/edit and approve access to the list.
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Workflow Tasks');
MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint LeadThanks
AlexanderShelopukho for
right answer!
Alex-
I do not need comparison-
I need Advantages and Disadvantages of Client Object Model in sharepoint 2013
MCTS Sharepoint 2010, MCAD dotnet, MCPDEA, SharePoint Lead -
Item.SystemUpdate for Client Object Model in sharepoint 2010
I have a javascript that modifies a column/field in the list item when opened. However, this changes the Last Modified By field of the item.
is there a SystemUpdate method for Client Object Model?
----------------------- Sharepoint NewbieI got a work around for this problem..
Before updating the Modified, Modified By values, First we need to Disable the version settings for document library. Once the fields updated then again we need to enable the version settings.
find the updated code below..
//Disable Version settings for DOC LIB
before update Metadata
_List.EnableVersioning
= false;
_List.Update();
_cContext.ExecuteQuery();
ListItem item = newFile.ListItemAllFields;
_cContext.Load(item);
//Updating Metadata Created,
CreatedBy, Modified, Modified By
item["Created"]
= "8/10/2013 7:04 PM";
item["Author"] = CreatedUserValue;
item["Modified"] = "8/10/2013 7:04 PM";
item["Editor"] = ModifiedUserValue;
item.Update();
_cContext.ExecuteQuery();
//Enable Version settings
for DOC LIB after update Metadata
_List.EnableVersioning
= true;
_List.Update();
_cContext.ExecuteQuery();
Rajendra -
Hi folks!
I have been busted my butt trying to Write a program changing the title of an existing webpart on on of our subsites on SharePoint online. But I keep getting an error in the very last context.executequery. Tried a bunch of different approaches, but I can't
make it work. Before I start posting code; I Wonder if anyone have ever done this?
Its a plain Windows form application, using Visual studio Express and the Client Object model. (Listsing the titles of the webparts Works but changing titles seem impossible. Thought it might be a checkin/out problem but it doesn't make a difference).
Any help would be highle appreciated.
LarsIt depends: are you using the default style for Text Captions? In that case you can change the default style in the Object Style Manager and have it applied to all Captions.
Or you can change one text caption, and in its Properties panel choose the option 'Save Changes to existing style' from the menu top right (see screenshot). Both methods will work if you didn't override the default Caption Style for those captions. Beware: Quizzing objects can use another style. -
I want to change 'Modified By' column value of a file that is being uploaded using Client Object Model in SharePoint 2013. The problem is that the version of the file is changing. Kindly help me. The code that I am using is:
using (System.IO.Stream fileStream = System.IO.File.OpenRead(m_strFilePath))
Microsoft.SharePoint.Client.File.SaveBinaryDirect(m_clientContext, str_URLOfFile, fileStream, true);
Microsoft.SharePoint.Client.File fileUploaded = m_List.RootFolder.Files.GetByUrl(str_URLOfFile);
m_clientContext.Load(fileUploaded);
m_clientContext.ExecuteQuery();
User user1 = m_Web.EnsureUser("User1");
User user2 = m_Web.EnsureUser("User2");
ListItem item = fileUploaded.ListItemAllFields;
fileUploaded.CheckOut();
item["UserDefinedColumn"] = "UserDefinedValue1";
item["Title"] = "UserDefinedValue2";
item["Editor"] = user1;
item["Author"] = user2;
item.Update();
fileUploaded.CheckIn(string.Empty, CheckinType.OverwriteCheckIn);
m_clientContext.ExecuteQuery();Hi talib2608,
Chris is correct for this issue, when calling update using ListItem.update method, it will increase item versions, using SystemUpdate and UpdateOverwriteVersion will update the list item overwrite version.
these two methods are not available in CSOM/REST, only server object model is available for this.
Thanks,
Qiao Wei
TechNet Community Support -
I am using windows authentication in my web application.
My requirement is to implement a sign out button which will sign out the user without having him to close the browser and application should not ask him to login again.
I tried following two options:
1. Redirecting the user to default signout.aspx page " /_layouts/15/SignOut.aspx "
2. Using "Sign In as a different user" URL " /_layouts/15/closeConnection.aspx?loginasanotheruser=true "
In first case, user is redirected to default sign out page but he can press "Go Back to Site" link to revisit the site. Another major issue is that the user has to close the browser to sign out from the application completely, which is not desirable
in my project requirement.
In second case, the the current user is signed out of the application but if the user has saved the password in browser, he gets signed in automatically to the application.
I also came across the solution where we replace the default sign out page with a custom sign out page, but I am not sure whether it can be implemented using JavaScript Client Object Model of SharePoint.Hi
I'm basically looking for the exact answer for the query.
Meanwhile you need to go through the link mentioned below in order to understand how to do it.
Debugging and Logging Capabilities in SharePoint 2010
Indul Hassan
Microsoft Community Contributor
http://www.indulhassan.com
You Snooze.. You Lose !! -
How to activate Custom Feature in SharePoint 2010 using Client Object model
I am trying to Activate a custom feature using Client Object Model in SharePoint 2010. Here is the code I used. When I execute the code, I got the error "Feature with Id 'xx' is not installed in this farm, and cannot be added to this scope while
creating site collection". Can anyone help?
ClientContext clientContext = new ClientContext(spURL);
//GUID of the custom feature
Guid districtFeatureId = new Guid("5b3529de-5045-46da-af87-8d2e32c121a7");
Site clientSite = clientContext.Site;
FeatureCollection clientSiteFeatures = clientSite.Features;
clientContext.Load(clientSiteFeatures);
clientContext.ExecuteQuery();
//Activate the feature
clientSiteFeatures.Add(districtFeatureId, false, FeatureDefinitionScope.Site);
clientContext.ExecuteQuery();Hi shil chan,
When you activate a feature on the site collection, the feature should be scoped to site or farm, the error message shows it cannot find the specific feature, this will happen when you have a feature in web
scope or the feature isn’t installed.
So, to troubleshooting this issue:
Verify whether the feature is scoped to web. Please go to
Site Setting->Site Features . If the feature is a web scope feature, then add the feature to webfeatures.
Make sure the feature is installed correctly.
Please inform me freely if you have any questions.
Thanks -
Client Object Model Sharepoint 2010
We are using client object model in sharepoint 2010
When we excute the ExcuteQuery method of clinet obejct model we are getting following error
The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again
GirishHi ,
A FormDigest control has to be included to create a digest for security validations when performing some modifications to SharePoint data. It adds a security token inside your page based on user, site and time. Once the page is posted back the security token
is validated. Once the security token is generated it’s valid for a configurable amount of time.
for more info check the below links
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.formdigest.aspx
http://ranaictiu-technicalblog.blogspot.com.au/2010/02/sharepoint-2010-client-object-model-for.html
if above link is not working, use below function before execute the query.
function CustomUpdateFormDigest()
if(window._spPageContextInfo != null)
var $v_2 = window._spPageContextInfo;
var $v_3 = $v_2.webServerRelativeUrl;
var $v_4 = window._spFormDigestRefreshInterval;
UpdateFormDigest($v_3, $v_4);
CustomUpdateFormDigest();
Please mark it as an answer/helpful if it is useful.
Thanks
Mahesh -
Hi,
I am using the Javascript Client object model.
I have a custom list and a custom document library.
Custom list contains 2 columns - dlName , dlValue
The document library contains 2 folders - "folder1" , "folder2" and contains some images.
The image name starts with the "dlValue" available in the custom list
I am using a visual webpart and using javascript client object model.
I am trying to achieve the below functionality:
1) Load a dropdown with the custom list.
2) set the image based on the value in dropdown.
I have achieved the first option, I have set the dropdown, but not sure how to query the folder and set the image.
Below is the code i have used so far:
//In Visual webpart
<select id="ddlTest" >
</select>
<br/>
<div id="PreviewLayer">
<img id="imgPlaceHolder" runat="server" alt="Image" title="imgPlaceHolder" src=" " />
</div>
// In Javascript file
function RenderHtmlOnSuccess() {
var ddlTest = this.document.getElementById("ddlTest");
ddlTest.options.length = 0;
var enumerator = this.customListItems.getEnumerator();
while (enumerator.moveNext()) {
var currentItem = enumerator.get_current();
var dropdownValue = currentItem.get_item("dlValue");
ddlTest.options[ddlTest.options.length] = new Option(currentItem.get_item("dlName"), dropdownValue);
setImage(dropdownValue); // Not sure how to query the folder and set the image based on value.
// Also if dropdown value is changed, corresponding image should be shown
How to query the folder and based on dropdown value, show the image? Also, how to handle the dropdown value change?
ThanksHi,
Here are two links for your reference:
Example of how to Get Files from a Folder using Ecmascript \ Javascript client object model in SharePoint 2010
http://sharepointmantra.wordpress.com/2013/10/19/example-of-how-to-get-files-from-a-folder-using-ecmascript-javascript-client-object-model-in-sharepoint-2010/
SP2010 JSOM Client Object Model: How to get all documents in libraries including all folders recursively
http://sharepoint.stackexchange.com/questions/70185/sp2010-jsom-client-object-model-how-to-get-all-documents-in-libraries-including
In SharePoint 2013, we can also use REST API to achieve it.
http://msdn.microsoft.com/en-us/magazine/dn198245.aspx
Thanks,
Dennis Guo
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Dennis Guo
TechNet Community Support -
Unable to get the SharePoint 2013 List names using Client object model for the input URL
Please can you help with this issue.
We are not able to get the SharePoint 2013 List names using Client object model for the input URL.
What we need is to use default credentials to authenticate user to get only those list which he has access to.
clientContext.Credentials = Net.CredentialCache.DefaultCredentials
But in this case we are getting error saying ‘The remote server returned an error: (401) Unauthorized.’
Instead of passing Default Credentials, if we pass the User credentials using:
clientContext.Credentials = New Net.NetworkCredential("Administrator", "password", "contoso")
It authenticates the user and works fine. Since we are developing a web part, it would not be possible to pass the user credentials. Also, the sample source code works perfectly fine on the SharePoint 2010 environment. We need to get the same functionality
working for SharePoint 2013.
We are also facing the same issue while authenticating PSI(Project Server Interface) Web services for Project Server 2013.
Can you please let us know how we can overcome the above issue? Please let us know if you need any further information from our end on the same.
Sample code is here: http://www.projectsolution.com/Data/Support/MS/SharePointTestApplication.zip
Regards, PJ Mistry (Email: [email protected] | Web: http://www.projectsolution.co.uk | Blog: EPMGuy.com)Hi Mistry,
I sure that CSOM will authenticate without passing the
"clientContext.Credentials = Net.CredentialCache.DefaultCredentials" by default. It will take the current login user credentials by default. For more details about the CSOM operations refer the below link.
http://msdn.microsoft.com/en-us/library/office/fp179912.aspx
-- Vadivelu B Life with SharePoint -
Sharepoint 2013 client object model FQL
Hi,
Im using Sharepoint 2013 client object model api and im trying to search on sharepoint by using FQL, but I dont get any results when Im using FQL, but when Im trying similar KQL syntax I get results.
I''ve heard that I need to enable the FQL but I can't find how, In 2010 api its a proeprty in KeywordQuery class.
code:
KeywordQuery keyword = new KeywordQuery(client);
// KQL
keyword.QueryText = "title:mon*";
// FQL
keyword.QueryText = "starts-with(title:string("mon"))";
Thank youTo enable FQL, you have to copy the default result source and modify the Query Transformation string {?{searchTerms} -ContentClass=urn:content-class:SPSPeople}, at one of these
levels -- Search Service Application (SSA), Site Collection, or Site -- and in one of the following ways:
Remove the KQL filter, -ContentClass:urn:content-class:SPSPeople, from the Query Transformation. The resulting Query Transformation string will be: {?{searchTerms}}
Replace the Query Transformation string with an FQL equivalent, such as {?andnot({searchTerms},filter(contentclass:"urn:content-class:SPSPeople*"))}.
Source :http://msdn.microsoft.com/en-us/library/office/jj163973.aspx
Bala -
SharePoint 2013 Client Object Model fetch image rendition info
Hi,
Below is the scenario I am trying with SharePoint 2013 managed client object model.
FrontEnd: ASP.Net web application
BackEnd: SharePoint 2013.
I have a publishing image with rendition applied and I am able to fetch the image URL like "/{site}/{lib}/{imagename}?RenditionId={id}".
I am able to download the file "/{site}/{lib}/{imagename}" using File.OpenBinaryDirect()
This is giving the original file without any renditions applied. If I use the same method with URL "/{site}/{lib}/{imagename}?RenditionId={id}", it gives me 400 Bad request error.
I have also tried using file.OpenBinaryStream() method with URL "/{site}/{lib}/{imagename}?RenditionId={id}" whichi still gives the original file without rendition
Please let me know how to fetch the below info using the rendition id?
RenditionVersion;
SourceImageWidth;
SourceImageHeight;
CropStartX;
CropStartY;
CropWidth;
CropHeight;
Alternatively, let me know if I could get the download file with rendition applied without requiring the above attributes.
Note: I am looking for solutions in client side programming (client object model/ web services (REST) . The server object model has classes "ImageRenditionCollection" and "ImageRendition" which can provide the above image info.
Thanks,
SrikanthTo enable FQL, you have to copy the default result source and modify the Query Transformation string {?{searchTerms} -ContentClass=urn:content-class:SPSPeople}, at one of these
levels -- Search Service Application (SSA), Site Collection, or Site -- and in one of the following ways:
Remove the KQL filter, -ContentClass:urn:content-class:SPSPeople, from the Query Transformation. The resulting Query Transformation string will be: {?{searchTerms}}
Replace the Query Transformation string with an FQL equivalent, such as {?andnot({searchTerms},filter(contentclass:"urn:content-class:SPSPeople*"))}.
Source :http://msdn.microsoft.com/en-us/library/office/jj163973.aspx
Bala -
Conflict between Client object model and Item Updated Event Receiver in sharepoint 2010
Hello All,
As per my requirement I have a two custom list.
Agent Details
Port Name
Agent Details contains Agent code, Port Name, email, address and phone of Agent. Its possible that one Agent Code is connected with multiple Port Name.
Basically what I am doing is I am getting port name connected with Agent code, using jquery and bind those values with check box(using javascript created dynamically) and bind all with Div tag.
Now when my custom edit form of Agent list open up it shows me different port name binding with checkbox group.
when user select the check box and click confirm button my clicent object model script will run and add this selected value into Port Name list.
After confirm one more button named Save will enable asking user to edit the email, phone or address value and when I click on save my Item updated event fires which update the values of the selected port name(These port name I am getting from port
name list) to Agent Details custom list.
Now when I am trying to update the values my event receiver fires or some times it got stuck(not firing). So could you please help me the possible alternative for this requirements.
Can we user the Ecma Script(Client object model to preserve the value of selectec port) and Item updated event receiver on the same time?
Is anything am doing wrong then please guide me.Hi,
As I understand, when you updated values in the agent details list the Item updated event receiver got stuck sometimes.
The item update event receiver will fire after the item has been saved, and the client object model script or the Ecma Script runs before the item is saved, so there is no conflict between the client object model script and item update event receiver.
You could find out the reason about the item update event receiver gets stuck by debugging the event receiver.
When you want to debug your event receivers, you have to attach to OWSTIMER.EXE and wait till they are executed. You can control this behavior using the Synchronization attribute. Also, if you’re looking for an easy way to debug an event receiver without
having to manually attach a debugger to your code, you can use the System.Diagnostics.Debugger.Launch() method.
The articles below are about how to debug in the event receiver in SharePoint 2010.
http://sharepoint-kings.blogspot.jp/2013/02/debugging-event-receivers-in-sharepoint.html
http://chakkaradeep.com/index.php/event-receivers-in-sharepoint-2010/
http://sharesaint.com/?p=77
Best regards,
Sara Fan
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
How to Enable Ratings on SharePoint List using Client Object Model code for Office 365 SharePoint Site.
Thanks in Advance
Rajendra KHi Rajendra,
here you are the code and the blog, let me know if this helps
using (ClientContext ctx = new ClientContext(https://yourSiteUrl))
Web w = ctx.Web;
List l = w.Lists.GetByTitle("yourListName");
ctx.Load(l, info => info.Id);
ctx.ExecuteQuery();
string ListID = l.Id.ToString();
Microsoft.Office.Server.ReputationModel.Reputation.SetRating(ctx, ListID, 1, 5);
ctx.ExecuteQuery();
http://blogs.technet.com/b/speschka/archive/2013/07/08/how-to-use-csom-with-ratings-in-sharepoint-2013.aspx
Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation -
Sharepoint client object model - Pull files from one site and move to another
Dear All,
I am using client object model to retrieve files of certain criteria using caml query and copy them to some other site using
client object model. There is no exception being thrown, but the application is not performing either. No files are being copied to destination. Here is the code. Please advise.
The message box that I have kept at the end is being displayed, but no files are being copied.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Net;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.SharePoint;
using SP = Microsoft.SharePoint.Client;
namespace WindowsFormsApplication2
public partial class Form1 : Form
public Form1()
InitializeComponent();
private void Form1_Load(object sender, EventArgs e)
private void button1_Click(object sender, EventArgs e)
SP.ClientContext srcContext = new SP.ClientContext(textBox1.Text);
srcContext.Credentials = new NetworkCredential(textBox3.Text, textBox4.Text, textBox5.Text);
SP.ClientContext destContext = new SP.ClientContext(textBox2.Text);
destContext.Credentials = new NetworkCredential(textBox3.Text, textBox4.Text, textBox5.Text);
SP.CamlQuery camlQuery = new SP.CamlQuery();
camlQuery.ViewXml = "<View Scope='RecursiveAll'><Query><Where><And><Geq><FieldRef Name='Created' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2013-01-01T04:16:20Z</Value></Geq><And><Lt><FieldRef
Name='Created' /><Value IncludeTimeValue='TRUE' Type='DateTime'>2013-12-31T04:16:43Z</Value></Lt><Or><Eq><FieldRef Name='Document_x0020_Classification' /><Value Type='Choice'></Value></Eq><Eq><FieldRef
Name='Document_x0020_Classification' /><Value Type='Choice'>Case Studies</Value></Eq></Or></And></And></Where></Query></View>";
SP.Web oWebsite = srcContext.Web;
srcContext.Load(oWebsite, website => website.Webs);
srcContext.ExecuteQuery();
SP.Web dWebsite = destContext.Web;
destContext.Load(dWebsite);
destContext.ExecuteQuery();
foreach (SP.Web web in oWebsite.Webs)
MessageBox.Show(web.Title);
foreach (SP.List list in web.Lists)
if (list.BaseType.ToString() == "DocumentLibrary")
MessageBox.Show(list.Title);
SP.ListItemCollection collListItem = list.GetItems(camlQuery);
srcContext.Load(collListItem);
srcContext.ExecuteQuery();
foreach (var doc in collListItem)
SP.File f = doc.File;
srcContext.Load(f);
srcContext.ExecuteQuery();
string destLibrary = "shared Documents";
string nLocation = dWebsite.ServerRelativeUrl.TrimEnd('/') + "/" + destLibrary.Replace(" ", "")
+ "/" + f.Name;
SP.FileInformation fileInfo = SP.File.OpenBinaryDirect(srcContext, f.ServerRelativeUrl);
SP.File.SaveBinaryDirect(destContext, nLocation, fileInfo.Stream, true);
MessageBox.Show("Completed");
sk.RakhishmaHi,
To copy files from one site collection to another site collection, the simplest way is to open document library in windows explorer view.
Go to document library, click library tab, click open with explorer.
You can open the document library1 in explorer then copy the files which you want to paste to another site collection
document library2, then open the document library2 in explorer to paste the documents.
Besides, there are other method:
https://social.msdn.microsoft.com/Forums/office/en-US/67282348-25c7-4bd0-9d95-61024c6892f9/how-we-move-a-document-library-from-one-site-collection-to-another-sitecollection?forum=sharepointgeneralprevious
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/8c112d85-1ab8-426b-be37-d010cf8647fe/copy-a-list-from-one-site-collection-to-another-using-web-service
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Maybe you are looking for
-
How can I uninstall Xerox print drivers and then reinstall them again
Somehow I installed the wrong print drivers for our xerox printers running on the latest version of leopard and installing the correct driver doesn't seem to solve the problem. I want to remove all xerox driver files and reinstall the correct version
-
IT0015: MORE THAN ONE KILOMETRE IN A MONTH
When we create more than one kilometre claim in the same month, the rate is incorrect. Create a kilometer claim for 24/04. In the amount field is the total(300) for all kilometres, in the number field the total kilometers(100). Create a kilometer cla
-
Secret hiding place for subscription billing dept?
I have never had such a nightmare customer service experience as I have had with my Adobe Forms Central subscription. There is no way to contact your billing department. How do I do that? I was double billed. I was on a monthly basic subscription and
-
Photoshop CC Save for Web Incorrect
Hi everyone, I recently purchased the Adobe CC suite for my Mac, OSX Mountain Lion. Trying to Save for Web (which works) but I'll select an option on the top right, lets just say JPEG 70% (or PNG or anything) for arguments sake and on the bottom left
-
So I noticed that the do javascript <path to script file> I have used in versions 7-CS4 causes an error now. "General Photoshop error occurred. This functionality may not be available in this version of Photoshop." However adding "file" do javascript