Friday, December 19, 2014

SharePoint Apps Privacy Policy

Privacy Policies

I am committed to protecting your privacy. The Privacy Statement applies to the SharePoint app(s) provided by using my name-Sandip Patil and governs data collection and usage. By using my SharePoint app(s), you consent to the data practices described in this statement.

Collection of your Personal Information
My app(s) does not collect any personally identifiable information.

Sharing of Information
My app(s) does not share or transfer any personal information with third parties.

Lost and Found App on SharePoint App Store

Lost & Found App is a best place for recovery of lost and found items within a company. Just place it on home page of company intranet portal and start using it.

Key features
  • Very simple and user friendly interface
  • Simple form for items reporting
  • Autocomplete suggestions for item search
  • App part available so it's very easy to place this app on site pages
  • No administration needed

App home page

  

Search Item: Type minimum 4 characters to get search results


Add Item: Title, Description and Category are mandatory fields



Display Item: Delete button is visible only for your own item



App Part: Add this App as app part on the site pages



I welcome your comments and suggestions. Thanks and enjoy the app..!



Thursday, November 20, 2014

Unable to navigate to SharePoint Hosted App and getting Invalid URL message

Our team had been working on one SharePoint Hosted App for couple of days, one day some team members were getting Invalid URL error after installing App to Developer site. Error message is

Invalid URL: ~appWebUrl/Pages/Default.aspx?SPHostUrl=https%3A%2F%2Fsportsoffice%2Esharepoint%2Ecom&SPLanguage=en%2DUS&SPClientTag=18&SPProductNumber=16%2E0%2E2930%2E1217&SPListItemId=1356&SPListId={A80C0C18-8AA6-4D27-9A2A-9E7556539D94}

We all sat together and tried to recollect what we did in last few days, we were using TFS as source control and everybody were check in their code at the EOD, so we checked version history and found that Package folder and package manifest lines in .csproj where missing in project.

Due to this Visual Studio couldn't build right App package, it missed App WSP in published package.

Just restoring Package folder and .csproj file fixed our issue.

Wednesday, November 5, 2014

Get web part assembly name and type name from SharePoint web part gallery


Today i was trying create to custom webpart preview page as test canvas for site admins. For this i wanted to add webpart on fly.  We need few properties like web part type name and web part assembly name for this.



string webPartTitle = " Content Editor Web Part";
string webPartTypeName = string.Empty;
string webPartAssemblyName = string.Empty;

SPList wpGallery = SPContext.Current.Site.GetCatalog(SPListTemplateType.WebPartCatalog);

SPQuery wpQuery = new SPQuery();

wpQuery.Query = @"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + webPartTitle + "</Value></Eq></Where>";
SPListItemCollection items = wpGallery.GetItems(wpQuery);

if (items != null && items.Count > 0)
{
       webPartTypeName = items[0]["WebPartTypeName"].ToString();
       webPartAssemblyName = items[0]["WebPartAssembly"].ToString();
}

Some other useful properties are below

- WebPartDescription
- WebPartPartImageLarge
- LinkWebPart
- WebPartIcon
- Group
- QuickAddGroups

Monday, October 13, 2014

SharePoint 2013: Use the cross-domain library in a tenant-scoped app (JSOM)

You will find code sample for cross-domain library in a tenant-scope app based on REST call on Microsoft site but not based on JSOM. I am not very much comfortable in REST calls so i decided to created similar example in JSOM.

Download sample code from here and just replace JavaScript in CrossDomainExec.js with below script




var web;
var hostweburl;
var appweburl;

function execCrossDomainRequest() {
    hostweburl =
         decodeURIComponent(
             getQueryStringParameter('SPHostUrl')
     );
    appweburl =
        decodeURIComponent(
            getQueryStringParameter('SPAppWebUrl')
     );

    var scriptbase = hostweburl + '/_layouts/15/';

    $.getScript(scriptbase + 'SP.Runtime.js',
        function () {
            $.getScript(scriptbase + 'SP.js',
                function () { $.getScript(scriptbase + 'SP.RequestExecutor.js', GetWebInfo); }
            );
        }
    );
}

function getQueryStringParameter(param) {
    var params = document.URL.split("?")[1].split("&");
    var strParams = "";
    for (var i = 0; i < params.length; i = i + 1) {
        var singleParam = params[i].split("=");
        if (singleParam[0] == param) {
            return singleParam[1];
        }
    }
}

function GetWebInfo() {
    var context;
    var factory;
    var appContextSite;
   
    context = new SP.ClientContext(appweburl);
    factory = new SP.ProxyWebRequestExecutorFactory(appweburl);
    context.set_webRequestExecutorFactory(factory);
    //appContextSite = new SP.AppContextSite(context, hostweburl);
    appContextSite = new SP.AppContextSite(context, document.getElementById("sitecoll1").value);//host url replaced by site collection url

    var web = appContextSite.get_web();
    context.load(web);

    context.executeQueryAsync(
        successHandler, errorHandler
    );

    function successHandler() {
        var oli = document.createElement("li");

        oli.innerText = web.get_title() + " (" + web.get_url() + ")";
        document.getElementById("WebTitles").appendChild(oli);
    }

    function errorHandler(sender, args) {
        document.getElementById("WebTitles").innerText = "Could not complete cross-domain call: " + args.get_message();
    }
}