Skip to content

Instantly share code, notes, and snippets.

#load assemblies and powershell snapin
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms")
Add-PSSnapin Microsoft.SharePoint.PowerShell
# end of loading assemblies
$form = new-object System.Windows.Forms.form
$form.Text = "Installed Apps in Host web"
#Textbox to enter Host web URL
@devendrasv
devendrasv / manifest.xml
Last active December 13, 2015 20:39
package manifest xml
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
SolutionId="6d5938d4-718c-4557-a8b2-02f2e081390a"
SharePointProductVersion="14.0">
<Assemblies>
<Assembly Location="SharePoint Product Version.dll" DeploymentTarget="GlobalAssemblyCache">
<SafeControls>
<SafeControl Assembly="SharePoint Product Version, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6fb9dacb5ba5cf05" Namespace="SharePoint_Product_Version.Projects_Webpart" TypeName="*" />
</SafeControls>
</Assembly>
</Assemblies>
# 1.create State service service application
$serviceApp = New-SPStateServiceApplication -Name "State Service ServiceApplication"
# 2.create State service service application Database
New-SPStateServiceDatabase -Name "StateService_serviceApplication_Database" -ServiceApplication $serviceApp
# 3.create State service service application proxy
New-SPStateServiceApplicationProxy -Name "State Service ServiceApplication proxy" -ServiceApplication $serviceApp -DefaultProxyGroup
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Data;
@devendrasv
devendrasv / complete-projects.cs
Last active December 11, 2015 20:39
Complete Solution
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace SharePoint_webpart.Projects
<?xml version="1.0" encoding="utf-8"?>
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="SharePoint_webpart.Projects.Projects, $SharePoint.Project.AssemblyFullName$" />
<importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Title" type="string">SharePoint-webpart - Projects</property>
@devendrasv
devendrasv / webpart-element.xml
Created January 28, 2013 15:09
webpart-element.xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
<Module Name="Projects" List="113" Url="_catalogs/wp">
<File Path="Projects\Projects.webpart" Url="SharePoint-webpart_Projects.webpart" Type="GhostableInLibrary">
<Property Name="Group" Value="Custom" />
</File>
</Module>
</Elements>
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace SharePoint_webpart.Projects
@devendrasv
devendrasv / correlation Id.ps1
Created January 23, 2013 14:53
get error details using powershell
get-splogevent -starttime (get-date).addminutes(-20) | where-object { $_.correlation -eq "e434f79b-68bb-40d2-0000-03a47eae1bf9" } | fl message > c:\errors1.txt
@devendrasv
devendrasv / List Instance Elements.xml
Created January 17, 2013 01:22
List Instance Elements.xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="TeamDetails"
OnQuickLaunch="TRUE"
TemplateType="10000"
Url="Lists/TeamDetails"
Description="My List Instance">
</ListInstance>
</Elements>