Posts

Showing posts from 2015

Enabling SideLoading in SharePoint Online for NON-DEVELOPER SITE

Image
Note1: By default this feature is enabled in “Developer Site”. So if your site is created with “Developer Site” template don’t read below (This is for the non-developer site) Note2: Enabling this feature is not recommended for Production Site. Sideloading apps is insecure. The main reason for blocking sideloading by default on non-developer sites is the risk that faulty apps pose to their host web/host site collection. Apps have the potential to destroy data and make sites or, given enough permissions, can even make site collections unusable. Therefore, apps should only be sideloaded in dev/test environments and never in production   (Ref: http://blogs.msdn.com/b/officeapps/archive/2013/12/10/enable-app-sideloading-in-your-non-developer-site-collection.aspx ) Pre-requisites -           Install Windows PowerShell from Windows Management Framework (I have installed Windows Management Framework 3.0) – ( https://www.microsoft.com/en-us/download/details.aspx?id=34595 )

JavaScript Namespaces

Good explanation of creating namespaces in javascript, http://www.kenneth-truyers.net/2013/04/27/javascript-namespaces-and-modules/

SharePoint Copy large document library by CSOM

class Program  {  static void Main(string[] args) {  ClientContext clntContext = new ClientContext(" https://<<SiteUrl>> "); FileCollection collFile = clntContext.Web.GetFolderByServerRelativeUrl(" https://<<DocumentLibraryUrl>>/").Files ; clntContext.Load(collFile); clntContext.ExecuteQuery();  foreach (File file in collFile) {  file.CopyTo(" <<Destiation document library url>> " + file.Name, true); Console.WriteLine(file.Name + " is copied successfully"); clntContext.Load(file); clntContext.ExecuteQuery(); }  Console.ReadLine(); } } }

Retreive User Profile Properties by using .NET CSOM in Office 365 / SharePoint Online

Image
using System.Text; using System.Threading.Tasks; using System.Security; using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.UserProfiles; namespace UserProfileCSOM { class Program { static void Main( string [] args) { const string serverUrl = "<<Site Url>>" ;             ClientContext cltContext = new ClientContext (serverUrl); var userAccountName = "i:0#.f|membership|test@test.com" ; var myUserName = "test@test.com" ; var myPassword = "*****" ; var secureStringPassword = new SecureString (); myPassword.ToList().ForEach(c => secureStringPassword.AppendChar(c));   var creds = new SharePointOnlineCredentials (myUserName, secureStringPassword); // Requires SecureString() for password cltContext.Credential

OOPS - Interface, Abstract, Delegate well explained in code

using System; using System.CodeDom.Compiler ; namespace csharpoops {                     abstract class test1                 {                                   public abstract int Fun(int a,int b);                                       public int Checking(int d,int e)                                   {                                                    d=3346;                                                  e=123;                                                return d-e;                                     }                   }                  //Interface Example                    public interface Icalc                 {                                     int fn_add(int x, int y );                 }                  //Structure Example                     struct employee                 {                                     public string name;