October 29, 2014

AppRegNew - Register New App - Office 365 - Provider Hosted App - Deploy

AppRegNew - Register New App - Office 365 - Provider Hosted App



1. Access _layouts/15/appregnew.aspx
2. Generate Client ID
3. Generate Client Secret
4. Give Title
5. App Domain (Azure Web Site without https://)
6. Redirect URI (Azure Web Site with https://)

Note:

1. Update Client ID and Client Secret in the web.config of the Web Project in the Solution.
Also, Update Client ID in the AppManifest.xml of the App.
2. Web Project --> Publish
3. Import the PublishSettings from the https://manage.windowsazure.com of your Azure Web Site.
4. Publish --> This will dpeloy all dll's and other artifacts to the Azure Web Site.
5. To Consume this, we need an app (ClientWebPart) deployed to our Office 365 Site.
6. In Elements.xml of the ClientWebPart App, replace appWebUrl with your AzureWebSIte Url and also StartPage in the Manifest.xml.
7. Right Click App Solution and Hit Deploy.

Error: Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.

Resolution:
1. Download and Install SharePoint Online Management Shell
2. Copy Powershell script from http://www.alexandervanwynsberghe.be/debugging-apps-for-sharepoint-online/ and save as .ps1.
3. Open the .ps1 in via SharePoint Online Management Shell via Run as Administrator.

Error: Error occurred in deployment step 'Install app for SharePoint': The application identifier is invalid, it must be a valid GUID.
Resolution: Update correct Client ID in the AppManifest.xml.

October 28, 2014

Azure DB - Database Project - Provider Hosted App



Azure DB - Database Project - Provider Hosted App

1. Create New Solution Folder --> DBProjects
2. Add New Project --> Other Languages --> SQL Server --> SQL Server Database Project.
3. Right Click and Publish to Create Profile pointing to our Database.
4. Create Folders (Generic etc)
5. Under Tables --> Add New  Table.
6. Publish

Note: Check in Database to check for newly created Table.

1. Add New Project --> SharePointOnline.Data
2. Add New Item --> ADO.NET Entity Data Model

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...