October 28, 2014

Preparing Visual Studio for Provider Hosted App (Naming Convention Style)

Preparing Visual Studio for Provider Hosted App (Naming Convention Style)

1. File --> New Project (SharePointOnline) --> App for SharePoint 2013
2. Remove default App and its corresponding Web Project.
3. Add New Project --> SharePointOnline.Apps
4. Remove its default App and keep its corresponding Web Project.
5. Create New Solution Folder --> Apps
6. Add New Project --> SharePointOnline.Apps
7. Remove its corresponding Web1 Project.
7. Add ClientWebPart to SharePointOnline.Apps
8. Remove Pages Folder and associated Features from the App.
9. In Solution Web Project --> Add New Item --> ClientWebPart.aspx in the Pages Folder.

Note:

1. App for SharePoint Web Toolkit --> TokenHelper.cs

2. All this Remove and Add Process is to get the Deploy Option for the App, Otherwise we need to package the app and upload to the app catalog of the Office 365 Site to consume the app.

May 05, 2014

REST - Web Services - CSOM - SharePoint 2013

REST

var query =


"/_api/web/lists/getbytitle('Employee')/items?$select=Title,Company,Manager&
$filter= ID eq '" + qryID + "'";


$.ajax({

url: _spPageContextInfo.webAbsoluteUrl + query,
 
type: "GET",

headers: { "ACCEPT": "application/json;odata=verbose" },

success: function (data) {

$.each(data.d.results, function (idx, item) {

console.log(item.Title); //Employee Title

console.log(item.Company.Title); //Company Title

console.log(item.Manager.Title); //Manager Title

});

},
 
 
error: function (data) {

}

});
 

Web Services

var listName = "myList";

$(document).ready(function() {
    var soapEnv =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
             <soapenv:Body> \
                  <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                     <listName>"+listName+"</listName> \
                     <viewFields> \
                         <ViewFields> \
                            <FieldRef Name='Title' /> \
                        </ViewFields> \
                     </viewFields> \
                 </GetListItems> \
             </soapenv:Body> \
         </soapenv:Envelope>";

   
    $.ajax({
        url: asmx(),
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: processResult,
        contentType: "text/xml; charset=\"utf-8\""
    });
});

function asmx() {

    var url = window.location.href;
    var urlin = url.substring(7);
    var urlsplit = urlin.split("/");
    var dolzina = urlsplit.length - 1;
    var naslov = new Array();
    for(i = 0; i < dolzina; i++){
        var naslov = naslov + urlsplit[i] + "/";
    }
    var asmx =  "http://" + naslov + "_vti_bin/lists.asmx";
    return asmx;

}

function processResult(xData, status) {
    $(xData.responseXML).find("z\\:row").each(function() {
        var liHtml = "
  • "
  • + $(this).attr("ows_Title") + " - " + $(this).attr("ows_Total") + "
    ";
            $("#data").append(liHtml);
        });
    }

    JavaScript Object Model (JSOM)

    <script type="text/ecmascript">
     
        SP.SOD.executeOrDelayUntilScriptLoaded(initialize, 'SP.js');   
        function initialize() {
            var clientContext = new SP.ClientContext();
            var siteColl = clientContext.get_site();
            myweb = siteColl.get_rootWeb();
            this.list = myweb.get_lists().getByTitle('ListTitle'); //Edit the title
            clientContext.load(list);
            clientContext.executeQueryAsync(Function.createDelegate(this, GetList), Function.createDelegate(this, getFailed));
        }
        function GetList() {
                alert(list.get_title() + ': ' + list.get_id().toString());
        }
      
        function getFailed() {
            alert('Failed.');
        }
    </script>

    SonarQube with Jenkins Setup using Docker Images

    https://funnelgarden.com/sonarqube-jenkins-docker/  https://medium.com/@hakdogan/an-end-to-end-tutorial-to-continuous-integration-and-con...