SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite site = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web;
using (SPSite newSite = new SPSite(site.ID))
{
using (SPWeb newWeb = newSite.OpenWeb(web.ID))
{
foreach (SPGroup group in newWeb.Groups)
{
foreach (SPUser u in group.Users)
{
if (SPContext.Current.Web.CurrentUser.Name == u.Name)
{
SPQuery depquery = new SPQuery();
depquery.Query = "<Where><Contains><FieldRef Name='Title' /><Value Type='Text'>" + group.Name + "</Value></Contains></Where>";
SPListItemCollection item = SPContext.Current.Web.Lists[Constants.HNBDepartmentList()].GetItems(depquery);
if (item.Count > 0)
{
grpName = group.Name;
}
}
}
}
}
}
});
Monday, February 15, 2016
Sunday, February 7, 2016
User Profile Syncronisation Service "Starting" Fixed
http://myspexp.com/2011/04/28/user-profile-synchronization-servicehangs-on-starting-i-fixed-it/
Monday, February 1, 2016
Adding and Install .wsp to a Site Collection using Powershell Commands
Stsadm
To Add : stsadm –o addsolution –name SharePointProject2.wsp
To Install : stsadm –o deploysolution –name SharePointProject2.wsp –url http://moss-server –allowCasPolicies –immediate
To Upgrade : stsadm –o upgradesolution –name SharePointProject2.wsp –filename SharePointProject2.wsp –immediate –allowCasPolicies
PowerShell
To Add : Add-SPSolution c:\code\SharePointProject2\bin\debug\SharePointProject2.wsp
To Install : Install-SPSolution –Identity SharePointProject2.wsp –WebApplication http://sp2010 -GACDeployment
To Update : Update-SPSolution –Identity SharePointProject2.wsp –LiteralPath c:\code\SharePointProject2\bin\debug\SharePointProject2.wsp –GACDeployment
To Uninstall : Uninstall-SPSolution –Identity SharePointProject2.wsp –WebApplication http://sp2010
To Remove : Remove-SPSolution –Identity SharePointProject2.wsp
Subscribe to:
Posts (Atom)