Wednesday, September 9, 2015

Create App Catalog in SharePoint online

Create App Catalog in SharePoint online
App Catalog: Make apps available to your organization and manage requests for apps. An app catalog is required to disable Store purchases for end users.

1.  Sign in to your SharePoint Online 2013 site as a tenant administrator.
2.  At the top of the page, choose Admin, SharePoint.
3.  On the SharePoint Administration Center page, choose apps, and then choose App Catalog. If you haven't already created an app catalog site collection, you will be prompted to create one.
4.  After the app catalog site collection is created, open it, and select Apps for SharePoint.
5.  On the App Catalog page, choose the new item link.
6.  On the Add a document form, browse to your app for SharePoint package and choose the OK button. A property form for new items opens.
7.  Fill out the form as needed and choose the Save button. The app for SharePoint is saved in the catalog.
8.  Browse to any website in the tenancy and choose Site Contents to open the Site Contents page.
9.  Choose add an app, and on the Your Apps page, find the app. If there are too many to scroll through, you can enter any part of the app title (Instrumentation) into the search box.
10. When you find the app, choose the Details link beneath it, and then on the app details page that opens, choose Add It.
11. You are prompted to grant permissions to the app. Choose Trust It.
12. The Site Contents page opens and the app is listed. For a short time, a message below the title indicates that it is being added. When this message disappears, you can choose the app icon to             launch the app. (You may need to refresh the page to make the message disappear.)
13. Exercise the app as described in the sample description above.

Tuesday, September 8, 2015

SharePoint 2013 Add a Geolocation column to a list programmatically

//SharePoint 2013 Add a Geolocation column to a list programmatically
//To set the Bing Maps key at the farm level using Windows PowerShell
1.       Log on to the SharePoint server as an administrator, and open the SharePoint 2013 Management Shell.
2.       Execute the following command:
Set-SPBingMapsKey –BingKey “ApJ8q265TyIbIz7TpAlxw2oYAf84LmS0a5Z24KT141LL8728c3X1d-aJqQWfpBD9"

//To set the Bing Maps key at the farm or web level using the client object model
//CONSOL Application
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            SetBingMapsKey();           
            ReadBingMapKeu();
        }
        private static void ReadBingMapKeu()
        {
            ClientContext context = new ClientContext("http://SPServer:6677/");
            Web web = context.Web;
            context.Load(web.AllProperties);
            context.ExecuteQuery();
            Console.WriteLine(web.AllProperties["BING_MAPS_KEY"].ToString());
            Console.ReadKey();
        }
        static private void SetBingMapsKey()
        {
            ClientContext context = new ClientContext("http://SPServer:6677/");
            Web web = context.Web;
            web.AllProperties["BING_MAPS_KEY"] = " ApJ8q265TyIbIz7TpAlxw2oYAf84LmS0a5Z24KT141LL8728c3X1d-aJqQWfpBD9";
            web.Update();
            context.ExecuteQuery();
            Console.WriteLine("Bing Maps set successfully");
        }
    }
}
Output:-
//SharePoint 2013: Add a Geolocation column to a list programmatically
//CONSOL Application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint; 
namespace AddGeolocationFieldSample
{
    class Program
    {
        static void Main(string[] args)
        {
            AddGeolocationField();
        }
        private static void AddGeolocationField()
        {
            ClientContext context = new ClientContext(@"http://SPServer:6677/");
            List oList = context.Web.Lists.GetByTitle("Test");
            oList.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location'/>", true, AddFieldOptions.AddToAllContentTypes);
            oList.Update();
            context.ExecuteQuery();
            Console.WriteLine("Geolocation field added successfully!");
            Console.ReadKey();
        }
    }
}
Output:-

Reference:-