$web = Get-SPWeb -Identity https://sharepoint/sites/PowerShellTests $folder = $web.Folders["Workflows"] $property = $folder.Properties["docid_msft_hier_listid_validate"] $dt = Get-Date -Year 2100 -Month 12 -Day 31 $folder.Properties["docid_msft_hier_listid_validate"] = $dt $folder.Update() $web.Update()
$url = "https://sharepoint/sites/PowerShellTests" $web = Get-SPWeb $url $lib = $web.GetList($web.Url + "/oldName") $rootFolder = $lib.RootFolder $rootFolder.MoveTo($web.Url + "/newName")
$wa = $get-spwebapplication "my site host url"$wa.Sites | foreach-object { if ( $_.Url.StartsWith("my site host url/personal") ) { Set-SPSite -Identity $_.Url -QuotaTemplate "Personal Site" }}
$analytics = Get-SPUsageDefinition | where { $_.Name -like "Analytics*" } $pageRequests = Get-SPUsageDefinition | where { $_.Name -like "Page Requests" }
$analytics.Receivers.Count $pageRequests.Receivers.Count
if ($analytics.Receivers.Count -eq 0) { $analytics.Receivers.Add( "Microsoft.Office.Server.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal. AnalyticsCustomRequestUsageReceiver") } if ($analytics.EnableReceivers -eq $false) { $analytics.EnableReceivers = $true $analytics.Update() } if ($pageRequests.Receivers.Count -eq 0) { $pageRequests.Receivers.Add( "Microsoft.Office.Server.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c", "Microsoft.Office.Server.Search.Analytics.Internal. ViewRequestUsageReceiver") } if ($pageRequests.EnableReceivers -eq $false) { $pageRequests.EnableReceivers = $true $pageRequests.Update() }
$farm = Get-SPFarm $file = $farm.Solutions.Item("MySolution.wsp").SolutionFile $file.SaveAs("c:\temp\MySolution.wsp")
# Configuration $app = Get-SPWebapplication "web app url" $jobname = "my job name" $siteurl = "site url will be used within the job" # Install $job = New-Object MyNamespace.MyClass( $jobname, $app, $siteurl) $job.Schedule = [Microsoft.SharePoint.SPSchedule]:: FromString("daily between 01:00:00 and 01:00:00") $job.Update() Restart-Service SPTimerV4 # Check (Get-SPTimerJob | where-object{$_.Name -eq $jobname)}) | fl
# enter valid values $url = "https://sharepoint.c2go.net/sites/test" $listName = "MyListName" $login = "MyLogin" $web = Get-SPWeb $url $userid = ($web.Allusers | where-object { $_.LoginName -eq $login }).ID $user = $web.AllUsers.GetByID($userid) $token = $user.UserToken; $impSite = New-Object Microsoft.SharePoint.SPSite ($web.Url, $token); $impWeb = $impSite.OpenWeb() $impList = $impWeb.Lists[$listName] $impList.Views
string url = "https://sharepoint/sites/teamsite";string domain = "myDomain";string login = "myLogin";string pwd = "myPassword"; // feature id for MySite Newsfeed webpart:Guid feature = new Guid("6928B0E5-5707-46a1-AE16-D6E52522D52B");using (var ctx = new ClientContext(url)){ ctx.AuthenticationMode = ClientAuthenticationMode.Default; ctx.Credentials = new System.Net.NetworkCredential(login, pwd, domain); var features = ctx.Site.Features; ctx.Load(features); ctx.ExecuteQuery(); features.Add(feature, true, FeatureDefinitionScope.None); ctx.ExecuteQuery();}
(function () { var overrideCtx = {}; overrideCtx.Templates = {}; overrideCtx.OnPostRender = [ HighlightRowOverride ]; overrideCtx.Templates.Fields={ "Colour":{"View":RenderColour}} SPClientTemplates.TemplateManager.RegisterTemplateOverrides (overrideCtx);})();function RenderColour(ctx) { var link = ctx.displayFormUrl + "&ID=" + ctx.CurrentItem.ID + "&source=" + encodeURIComponent(window.location.href); var text = "< a class='ms-core-suiteLink-a' href='" + link + "'>< img src='/_layouts/15/images/icgen.gif'>"; return text;}function HighlightRowOverride(inCtx) { for (var i = 0; i < inCtx.ListData.Row.length; ++i) { var listItem = inCtx.ListData.Row[i]; var iid = GenerateIIDForListItem(inCtx, listItem); var row = document.getElementById(iid); if (row != null) { row.style.backgroundColor = listItem.Colour; } } inCtx.skipNextAnimation = true;}
$followedSite = „https://sharepoint/sites/news“$loginName = „roloff“$profile = $upm.GetUserProfile($loginName)$manager = New-Object Microsoft.Office.Server.Social.SPSocialFollowingManager($profile)$actorInfo = New-Object Microsoft.Office.Server.Social.SPSocialActorInfo$actorInfo.ContentUri = $followedSite$actorInfo.ActorType = 2 # SPSocialActorType.Site$manager.Follow($actorInfo)
$adGroup = "" # AD Group with MySite users$siteURL = "" # any local SharePoint Site will do$members = Get-ADGroupMember -Identity $adgroup -Recursive | sort name# get UserProfileManager$serviceContext = Get-SPServiceContext -site $siteURL -ErrorAction Stop$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) -ErrorAction Stopforeach ($member in $members){if ($upm.UserExists($member.SamAccountName)){ $profile = $upm.GetUserProfile($member.SamAccountName) $perssite = $profile.PersonalSite if ($perssite -eq $null) { # either this $profile.CreatePersonalSite(1031) # should work in most cases # or this # $profile.CreatePersonalSiteEnque($true) # will work in all cases; gets language from mysite host $perssite = $profile.PersonalSite if ($perssite -eq $null) { # do some error handling } }}}
Get-SPDatabase | where-object { $_.TypeName -eq "Content Database" } | select Displayname, @{Name="Mbytes";Expression={$_.DiskSizeRequired/ 1Mb}}
# URL to your MySite web application$MySiteWebUrl = "https://mysite.collaboration-2-go.net" # where to find users in the AD$searchbase="DC=collaboration-2-go,DC=net" # required if server domain and user domain are different$dc="my_domain_controller" # required if server language is English and# MySite language is different$culture = "de-DE"$webapp = Get-SPWebApplication -identity $MySiteWebUrl[System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture foreach ($site in $webapp.Sites){ # Get Active Directory Information $login = $site.Owner.LoginName if ($login.contains("\")) { $login = $login.substring($login.indexof("\") + 1) } $ldapfilter = "(SamAccountName=" + $login + ")" $aduser = Get-ADUser -LDAPFilter $ldapfilter -SearchBase $searchbase -Server $dc $displayName = $aduser.GivenName + " " + $aduser.Surname if ($displayName -eq " ") { $displayName = $site.owner.DisplayName } if ($site.RootWeb.WebTemplate -eq "SPSPERS") # ignore MySite host { # more sophisticated approach is possible but # I'm not sure about the blog URL foreach ($web in $site.AllWebs) { if (($web.WebTemplate -eq "BLOG") -and ($web.Title -eq "Blog")) { $title = "Blog von " + $displayName $web.Title = $title $web.Update() } $web.Dispose() } } $site.Dispose()}
$web = Get-SPWeb https://sharepoint/sites/blogwrite-host $web.Properties["ms-blogs-skinid"]$web.Properties["ms-blogs-skinid"] = 1$web.Properties.update()
c:\Windows\System32\inetsrv\appcmd.exe list wp
<Where> <Eq> <FieldRef Name='Name' /> <Value Type='Lookup'>Smith</Value> </Eq> </Where>
<Where> <Eq> <FieldRef Name='Name' LookupId='True' /> <Value Type='Lookup'>7</Value> </Eq> </Where>
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <HideCustomAction Id="HideDeleteSPWeb" GroupId="SiteTasks" HideActionId="DeleteWeb" Location="Microsoft.SharePoint.SiteSettings"> </HideCustomAction> </Elements>
Field ID="{9D6556BF-D5AC-41B7-94BA-56ABE77CEDC8}"
Unable to locate the xml-definition for FieldName with FieldId '9D6556BF-D5AC-41B7-94BA-56ABE77CEDC8', exception: Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException (0x8000FFFF): 0x8000ffff at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt32 lcid, Object varIdBytes)…