ĐÀO TẠO DOANH NGHIỆP : SỞ KHOA HỌC CÔNG NGHỆ TỈNH ĐỒNG NAI

ENTERPRISE TRAINING: DONG NAI DEPARTMENT OF SCIENCE AND TECHNOLOGY.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

Tuesday, March 8, 2016

SharePoint 2010 get list items using list.asmx service using Jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="/Style%20Library/DownloadDocuments/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function popupCenter(title, w, h, url) {
            var url = "/SitePages/Download.aspx?ID=" + url;
            var left = (screen.width / 2) - (w / 2);
            var top = (screen.height / 2) - (h / 2);
            var win = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
            win = null;
            return false;
        }


        function GetSoapQuery() {
            var soapEnv =
                "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>ListOfDownloadDocument</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='ID' />\
                               <FieldRef Name='Title' />\
                               <FieldRef Name='LinkToDocument' />\
                               <FieldRef Name='IsShow' />\
                               <FieldRef Name='DisplayOrder' />\
                           </ViewFields> \
                        </viewFields> \
                        <query> \
                         <Query> \
                           <Where> \
                              <Eq> \
                                 <FieldRef Name='IsShow' /> \
                                 <Value Type='Integer'>1</Value> \
                              </Eq> \
                           </Where> \
                           <OrderBy> \
                               <FieldRef Name='DisplayOrder' Ascending='true'/> \
                           </OrderBy> \
                </Query> \
             </query> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";
            return soapEnv;
        }

        $(document).ready(function () {
            var soapEnv = GetSoapQuery();
            $.ajax({
                url: "http://ServerName/_vti_bin/lists.asmx",
                type: "POST",
                dataType: "xml",
                data: soapEnv,
                complete: processResult1,
                contentType: "text/xml; charset=\"utf-8\""
            });
        });


        function processResult1(xData, status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function () {
                var id = $(this).attr("ows_ID");
                /*alert("ID:" + id);*/
                var title = $(this).attr("ows_Title");
                /*alert("Title:" +title);*/
                var linkToDocument = $(this).attr("ows_LinkToDocument");
                var hyperLink = linkToDocument.split(',')[1];
                /*alert("hyperLink:" +hyperLink);*/

                /*$("#download").append('<li><p><a href="javascript:void(0);" onclick="popupCenter(&#39;myPop1&#39;,450,200,&#39;' + hyperLink + '&#39;);">' + title + '</a></p></li>');*/
                $("#download").append('<li><p><a href="javascript:void(0);" onclick="popupCenter(&#39;myPop1&#39;,450,200,' + id + ');">' + title + '</a></p></li>');
            });
        }   
 
    </script>
   
   
    <h1>List of download document</h1>
        <ul id="download">
        </ul>
    </div>