Powershell Command to add a file to root of SharePoint

This blog will explain about adding a file to SharePoint root.Generally sharepoint structure is http://server/pages/page1.htmlSuppose you need to add a file in root which should access by http://server/page1.html This can be done by powershell command. Write-Host “Powershell started…..”Add-PSSnapIn Microsoft.SharePoint.PowerShell$fileBytes = [system.io.file]::ReadAllBytes(“C:myfolderpage1.html”);$site = Get-SPSite “http://server”;$site.RootWeb.Files.Add(“page1.html“, $fileBytes, $true);Write-Host “Done…”

Create SharePoint List with Code and CAML

CAML is an XML based language used for access SharePoint objects like List, Library, Content-Type, Site Columns. To know more about CAML Query, please visit my another blog post Learn CAML Query step by StepCAML comes under declarative and the code that we write using SharePoint server object model comes under imperative programming. How to … Read more

Linq in C# Programming

Before using LINQ in C#, please read my earlier blog to get some basic idea about what is LINQ? LINQ can be used in C# in different ways : One way is to use with Lambda ExpressionAnother way is to use Anonymous function Below code will return string of length less than 5. string[] countryArr = … Read more

How to run SharePoint code with Elevated Privileges ?

SharePoint elevated privileges, site collection administrator code RunWithElevatedPrivileges is a class in SharePoint which comes under SPSecurity namespace. It allows developers to create the code that runs as the System Account instead of the logged in user, essentially giving that user Administrator Level Permissions in a specific space. What are the security risks in it ? So there is … Read more

How to overload a web method in web service – ASP.Net

We can define Method Overloading as , Same Methods name with different type of parameter or different set of parameters. Web method overloading is not straight forward in use. Suppose there are 2 methods in a web service.  public string GetEmployee(int employeeId)    {        string empName = string.Empty;        //write … Read more

C# Code to get user details from FaceBook

In this blog i am going to explain about how some one can get user details from Facebook and later use data for user registration, user login and for some other purpose. First you need to create a Facebook APP, You can check here how to create facebook app. Once you are ready with the Facebook … Read more

How to create a blank SharePoint Page? SharePoint Branding

I was working on a project where all my SharePoint inherits from a custom master page with predefined Page Layout. I got a requirement where i need to create few pages with different layouts. There are various ways to do this. One is to create a new Page Layout by coding and select your layout … Read more

Introduction to Linq to SharePoint

Introduction to Linq to SharePoint LINQ is a way to access external data sources.SharePoint Foundation 2010 comes with its own LINQ to SharePoint provider.The namespace which contains the provider is Microsoft.SharePoint.Linq.dll. LINQ provides strongly typed classes, this is an advantage of LINQ over CAML query.Another advantage of LINQ is that Visual Studio provides IntelliSense to … Read more

Is it important to dispose an object in SharePoint ?

SharePoint foundation 2010 and SharePoint server 2010 object model contain objects that implement the IDisposable interface. Object disposal is very important in SharePoint. What is Disposing Object? Sharepoint foundation 2010 and sharepoint server 2010 object model contain objects that implement the IDisposable interface.You should explicitly dispose those sharepoint objects that implements IDisposable when you are … Read more

What is Parent Content Type in SharePoint 2010?

What is Parent Content Type in SharePoint 2010? As you know content type in SharePoint gives re-usability features. Parent Content Type is a hierarchical relationship between two content types. Parent Content Type defines the properties for a child content type which inherits all properties of parent content type. For Eg Lets create a document library … Read more

RSS
YouTube
YouTube
Instagram