I am unable to add item in any sharepoint list programmatically from a custom web part. list.AddItem() doesn't work.
122089
I try to add an item to my sharepoint list from a custom web part. Is there any mistake in my code?  [WebMethod]         public static string AjouterDemande()         {             SPList ListeDemandeConge = SPContext.Current.Site.RootWeb.Lists["DEMANDE CONGÉ"];             SPListItem ListItem = ListeDemandeConge.Items.Add();             ListItem["CODE"] = code;             ListItem["DEMANDEUR"] = Utilisateur.LoginName;             ListItem["DATE DEMANDE"] = DateTime.Today.Date;             ListItem["DATE FIN"] = EndDateD;             ListItem["DATE DEPART"] = StartDateD;             ListItem["DUREE"] = int.Parse(DayCount);             ListItem["PREMIER RESPONSABLE"] = Employe.FirstSuperior.LoginName;             ListItem["DEUXIEME RESPONSABLE"] = Employe.SecondSuperior.LoginName;             ListItem["PRESENCE PRES"] = Boolean.Parse(FirstRespPresent);             ListItem["SOLDE CONGE"] = Conge.SoldeAnneeConge;             ListItem["MOIS"] = int.Parse(StartDateTab[1]);             ListItem["ANNEE"] = int.Parse(StartDateTab[0]);             ListItem["JOURS APPROUVEES"] = 0;             ListItem.Update();             ListeDemandeConge.Update();             return "true";          }   When I use F10 to process debugging step by step and get to my listitem.update(), it went out without giving any error.
108461
I am using SharePoint 2013 online (Office 365). I am following some JSLink tutorial where I am showing indicator icons in columns. It looks like the .js file is working, but when I change the file and check it in, I don't see any changes.   I have created a custom list with a column with choices : Green, Red, Yellow. After this I created a page and added this list as a webpart.   On this webpart I have set a path of my .js file. In this .js file there is some logic where the control is overridden with an icon. I see a broken image. I did some changes in my js file, but I still see the old path of the image. Is there some caching in SharePoint which is using the js file??  This is the tutorial:
15693
How to move item to folder automatically when it has been added or edited in a library? The folder is in the same library. The correct folder will be defined by metadata. This should happen automatically when the item has been added or edited. The listitem Id should be preserved. No server-side code should be deployed.  Can this be done using workflows (SP2010/SP2013)? If not then what would be the other options?
58244
There seems to be a widely popular blog post () about creating these. It's tailored to SharePoint 2007, but I've read through the entire article, and it makes sense. I've followed the directions, but the emails that come through don't contain any of my changes. I've also followed directions and code to change the alert template for a specific list (done through the object model). And after I make the changes, I can get to the list through the object model and verify that my changes are saved in the AlertTemplate property for the list - but the changes don't actually come through in the alert emails. And finally, I've tried adding a new NotificationHandlerAssembly to send out a completely custom email, but the custom code in my assembly doesn't get called and my email doesn't go out - with no errors present in the Logs.
18143
can anyone please provide steps to follow for migratng custom web parts which has code based .wsp file form sharepoint 2007 to sharepoint 2010.Thanks in advance
76641
I need to get item from list sharepoint by Id I use this code and it give me all the items of the list :  &lt;script&gt;  function parseURLParams(url) {         var queryStart = url.indexOf("?") + 1,             queryEnd = url.indexOf("#") + 1 || url.length + 1,             query = url.slice(queryStart, queryEnd - 1),             pairs = query.replace(/\+/g, " ").split("&amp;"),             parms = {}, i, n, v, nv;          if (query === url || query === "") {             return;         }          for (i = 0; i &lt; pairs.length; i++) {             nv = pairs[i].split("=");             n = decodeURIComponent(nv[0]);             v = decodeURIComponent(nv[1]);              if (!parms.hasOwnProperty(n)) {                 parms[n] = [];             }              parms[n].push(nv.length === 2 ? v : null);         }         return parms;     }  $( window ).load(function() {   var urlString = document.URL;  urlParams = parseURLParams(urlString);  ExecuteOrDelayUntilScriptLoaded(retrieveActualite, "sp.js");          var siteUrl = '/sites/securite';      function retrieveActualite() {              var clientContext = new SP.ClientContext(siteUrl);             var oList = clientContext.get_web().get_lists().getByTitle('Actualite');             var camlQuery = new SP.CamlQuery();              camlQuery.set_viewXml('&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=”ID” LookupId="TRUE"/&gt;&lt;Value Type="Text"&gt;' + urlParams.IdArt[0] + '&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;');             this.collListItem = oList.getItems(camlQuery);             clientContext.load(collListItem);             clientContext.executeQueryAsync(onQuerySucceededActualite, onQueryFailed);         }          function onQuerySucceededActualite(sender, args) {              var listItemInfo = '';              var listItemEnumerator = collListItem.getEnumerator();             while (listItemEnumerator.moveNext()) {                 var oListItem = listItemEnumerator.get_current();                   var desc=oListItem.get_item('Description');                 $('#idArticle').append('&lt;label class="titleArticle"&gt;'+oListItem.get_item('Title')+'&lt;/label&gt; &lt;br&gt;&lt;br&gt;&lt;p class="ContenuArticle" &gt;'+desc+'&lt;/p&gt;');                          }         }          function onQueryFailed(sender, args) {              alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());         }       });    &lt;/script&gt;   so how can I get only the considered item ?
16114
I want to add values to a lookupmulti field with c#. the form shows the field correctly but my code just won't work:  SPList list = SPContext.Current.Web.Lists["testlist"]; SPListItem item = list.GetItemById(someId); SPFieldLookupValueCollection fieldValues = new SPFieldLookupValueCollection(); foreach(int id in itemIds) {    fieldValues.Add(new SPFieldLookupValue {LookupId = id}); } item["lookupmultifield"] = fieldValues;   The code above is not exactly my code, but it's how i thought it should work.  FieldValues has 2 entries, but only the first is inserted in the lookupmulti field. can anyone help?
94863
Any Answers Will Help me to Forward and Gain Knowledge in SharePoint Development  While i am Trying to get the list Items Using Rest API Calls in SharePoint Hosted App Using Below Function  function loadingSamples()  {     var JobListName = "RRR Jobs #";     var executor;     // Initialize the RequestExecutor with the app web URL.     executor = new SP.RequestExecutor("/");      //Fetching the choice values from the Job Status Field, to show in the Dropdown field     executor.executeAsync     ({         url: "/_api/web/lists/getbytitle('" + encodeURIComponent(JobListName) + "')/fields/getbytitle('Job Status')?$select=Choices",         method: "GET",         headers: { "Accept": "application/json; odata=verbose" },         success: successHandlerStatus,         error: errorHandler     }); } function successHandlerStatus(data)  {     alert("sucesss") }  function errorHandler(data, errorCode, errorMessage)  {     alert("errorMessage") }   It's always going to error function named errorHandler With  Error Code as -1002 and Error Message as Bad Request and Inside Data -> Body , the Error message is  {     "error":{            "code":"-1,Microsoft.SharePoint.Client.InvalidClientQueryException",         "message":{             "lang":"en-US",             "value":"The expression \"web/lists/getbytitle('DWR Jobs \" is not valid."         }     } }   Note :    This is working code in Sharepoint Hosted App that previously hosted in another Windows server. Now i hosted this App in New windows server,it's successfully hosted but it gives above mentioned Error in Rest Service Call.
15603
I have a SharePoint that has list and I need to be able to update this list with new values from an Excel sheet (using VBA).  This can be done from Access not a problem however I need it to be Excel only.  Is what I am asking possible and if some could point me in the direction of a solution.
12369
I currently use the   to retrieve data from several SharePoint lists.  This is my current preferred method of coding my way from ASP.NET and WinForms to retrieve this data.   My only issue with this project:  I have to manually generate the SPML file and add this to the development environment, compile it in the project, and only then I am able to use it to connect to the List.  This is great for projects that require connecting to the one and the same list always.  But I am having users creating new workspaces (sites) with each its own List from which I want to retrieve data automagically (same as linq to sharepoint does, but not statically).  Can you recommend your preferred way of accessing data from several SharePoint Lists and sites in C# WinForms and/or ASP.NET outside an actual SharePoint environment where I can specify the a new source site and list at run time?
63934
I need a list of SharePoint objects which need to be disposed.  This is for code analysis purpose. I have got a code review today and want a quick list of the objects to look out for in the code.  UPDATE Here is what to dispose and what not to dispose, if there is anything more to add then kindly advise:-  Dispose the SPWeb obtained by iterating over the Site.AllWebs collection  SPC110201: Dispose created SPSite objects  SPC110203: Dispose SPWeb objects created with SPSite.OpenWeb  SPC110204: Dispose SPSite objects created with SPSite.SelfServiceCreateSite  SPC110205: Dispose SPWeb created by SPLimitedWebPartManager  SPC110211: Dispose SPSite created by SPSiteCollection.Add  SPC110212: Dispose SPSite created by SPSiteCollection[] index operator  SPC110213: Dispose SPWeb created by SPWebCollection.Add  SPC110214: Dispose SPWeb created by SPWebCollection[] index operator  SPC110231: Do not dispose SPListEventProperties.Web  SPC110232: Do not dispose SPWebEventProperties.Web  SPC110233: Do not dispose SPItemEventProperties.Web  SPC110234: Do not dispose SPItemEventProperties.ListItem.Web  SPC110235: Do not dispose SPItemEventProperties.Web.Site  SPC110236: Do not dispose SPItemEventProperties.ListItem.Web.Site  SPC110237: Do not dispose SPFeatureReceiverProperties.Feature.Parent  SPC110241: Do not dispose SPSite.RootWeb  SPC110242: Do not dispose SPWeb.ParentWeb  SPC110243: Do not dispose SPList.ParentWeb  SPC110244: Do not dispose SPSite returned by SPControl.GetContextSite  SPC110245: Do not dispose SPWeb returned by SPControl.GetContextWeb  SPC110246: Do not dispose SPSite returned by SPContext.Current.Site  SPC110247: Do not dispose SPWeb returned by SPContext.Current.Web  SPC110261: Close PublishingWeb created by PublishingWeb.GetPublishingWebs[] index operator  SPC110262: Close PublishingWeb created by PublishingWeb.GetVariation  SPC110263: Close PublishingWeb created by PublishingWebCollection.Add  SPC110281: Dispose SPSite created with UserProfiles.PersonalSite  Reference:
48477
I am creating a new custom button or link, and when i try to use a Visualforce page my content dropdown list is empty. How do i get a VF page to trigger on a custom button or link.
90767
When you drag and drop single / multiple files into a document set / library, SharePoint just add values to the required fields and a check the file out.   I've tried to use quick edit but it does not work to change content type. The only way is to edit properties and then check it in.  Is there a quicker way to change content type on a single file?
4553
I've been doing a LOT of research to try to figure out how to do this, but nothing is working. I have a column named "Update Item" that I want to be a link to start a workflow. I have workflow setup that will populate that field. The first step sets a workflow variable to   "https://www.mysite.org/site/_layouts/IniWrkflIP.aspx?List={f5c87ae4-1796-4310-aeb0-1e57edef6f87}&amp;[%Current Item:ID%]&amp;TemplateID={5773b102-16f1-4d45-9767-cb26db3bd72c}&amp;Source=https://www.mysite.org/site/"    without the quotations. The second step updates the current item's "Update Item" field to the value of the workflow variable. When running the workflow, it errors out saying "The workflow could not update the item, possibly because one or more columns for the item require a different type of information." The only thing I can think is that since the variable is set as a string, the hyperlink column can't be updated to that value.   I've tried replacing   [%Current Item:ID%] with {ItemID} per the suggestion of another site.    The workflow didn't fail, but the URL did not render correctly. Please help.
85664
Is it possible to add a node reference field using the  module?  If it is, how can I add it in my webform?
114343
Is it possible to create a document-library via SharePoint Rest API?
123803
I am attempting to add a calendar to my Default.aspx in my sharepoint hosted add-in in visual studio. I used the default code-snippet for adding sharepoint lists. Here's what I added to my Default.aspx:    &lt;WebPartPages:WebPartZone runat="server" FrameType="Default" ID="full" Title="loc:full"&gt;     &lt;WebPartPages:XsltListViewWebPart runat="server"         ListUrl="Lists/Calendar"         IsIncluded="True"         JsLink="clientTemplate.js"         NoDefaultStyle="TRUE"         PageType="PAGE_NORMALVIEW"         Default="False"         ViewContentTypeId="0x"&gt;     &lt;/WebPartPages:XsltListViewWebPart&gt; &lt;/WebPartPages:WebPartZone&gt;     and this is the result...    Pretty dang ugly if you ask me. How can I get this looking like a normal share point calendar instead of an unusable mess?  Thank you!