jeudi 5 février 2015

get listItems using COM



I need to get the items of my SharePoint list : I used COM to get the items. this is the code:



<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ImgAccueilWebPart.ascx.cs" Inherits="BDTN.DeliceDanone.BDTN.ImageAccueilFeature.ImgAccueilWebPart.ImgAccueilWebPart" %>


<script type="text/javascript" src="../../_layouts/15/BDTN.DeliceDanone/scripts/Img-Animation-js-slider/jquery-1.9.1.min.js"></script>
<!-- use jssor.slider.mini.js (40KB) instead for release -->
<!-- jssor.slider.mini.js = (jssor.js + jssor.slider.js) -->
<script type="text/javascript" src="../../_layouts/15/BDTN.DeliceDanone/scripts/Img-Animation-js-slider/jssor.js"></script>
<script type="text/javascript" src="../../_layouts/15/BDTN.DeliceDanone/scripts/Img-Animation-js-slider/jssor.slider.js"></script>




<script type="text/javascript" src="../../_layouts/15/SP.js"></script>

<script type="text/javascript" src="../../_layouts/15/BDTN.DeliceDanone/scripts/Img-Animation-js-slider/jquery-1.9.1.min.js"></script>
<!-- use jssor.slider.mini.js (40KB) instead for release -->
<!-- jssor.slider.mini.js = (jssor.js + jssor.slider.js) -->
<script type="text/javascript" src="../../_layouts/15/BDTN.DeliceDanone/scripts/Img-Animation-js-slider/jssor.js"></script>
<script type="text/javascript" src="../../_layouts/15/BDTN.DeliceDanone/scripts/Img-Animation-js-slider/jssor.slider.js"></script>

<script>

$(document).ready(function () {

// Make sure the SharePoint script file 'sp.js' is loaded before your
// code runs.
//SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItems());

ExecuteOrDelayUntilScriptLoaded(retrieveListItems, "sp.js");

var siteUrl = '/sites/test';


function retrieveListItems() {

var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('imageAccueilLD ');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>1</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

}

function onQuerySucceeded(sender, args) {

var listItemInfo = '';

var listItemEnumerator = collListItem.getEnumerator();

while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
listItemInfo += '\nID: ' + oListItem.get_id() +
'\nTitle: ' + oListItem.get_item('Title');

$("#puthere").append("<div style='background-color:steelblue'>" +
oListItem.get_item('Title') +
"</div>");

}

alert(listItemInfo.toString());
}

function onQueryFailed(sender, args) {

alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
});


</script>


<script>
jQuery(document).ready(function ($) {
//$("#puthere").append("<div style='background-color:steelblue'>" +
// "bbb" +
// "</div>");
//$("#puthere").append("<div style='background-color:red'>" +
// "ccc" +
// "</div>");

var _SlideshowTransitions = [
//Fade
{ $Duration: 1200, $Opacity: 2 }
];

var options = {
$SlideDuration: 500, //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
$DragOrientation: 3, //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
$AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
$AutoPlayInterval: 1500, //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
$SlideshowOptions: { //[Optional] Options to specify and enable slideshow or not
$Class: $JssorSlideshowRunner$, //[Required] Class to create instance of slideshow
$Transitions: _SlideshowTransitions, //[Required] An array of slideshow transitions to play slideshow
$TransitionsOrder: 1, //[Optional] The way to choose transition to play slide, 1 Sequence, 0 Random
$ShowLink: true //[Optional] Whether to bring slide link on top of the slider when slideshow is running, default value is false
}
};

var jssor_slider1 = new $JssorSlider$("slider1_container", options);

});


</script>

<div id="slider1_container" style="position: relative; width: 600px;
height: 300px;">

<!-- Loading Screen -->
<div u="loading" style="position: absolute; top: 0px; left: 0px;">
<div style="filter: alpha(opacity=70); opacity:0.7; position: absolute; display: block;
background-color: #000; top: 0px; left: 0px;width: 100%;height:100%;">
</div>

</div>

<!-- Slides Container -->
<div u="slides" style="cursor: move; position: absolute; left: 0px; top: 0px; width: 300px; height: 200px;
overflow: hidden;" id="puthere">

<div style="background-color:steelblue">
aaa
</div>

</div>
<a style="display: none" href="http://www.jssor.com">image slider</a>
</div>


the error is :



ScriptResource.axd, Ligne 786 Caractère 71 SCRIPT5007: Impossible d’obtenir la propriété « isNullOrUndefined » d’une référence null ou non définie


SP.js, Ligne 2 Caractère 11484 SCRIPT5022: Sys.InvalidOperationException: Le type SP.ULSTraceLevel a déjà été inscrit. Il est possible que ce type ait été défini à plusieurs reprises ou que le fichier de script qui le définit ait déjà été chargé. Cela peut être dû à une modification de paramètres durant une mise à jour partielle. ScriptResource.axd, Ligne 1647 Caractère 38



Anuy ideas . Best regards








0 commentaires:

Enregistrer un commentaire