Tag Info

New answers tagged

0

Something like: $sitecol = New-Object Microsoft.SharePoint.SPSite($webURL) $web = $sitecol.OpenWeb() $list = $web.Lists[$listName] $foldername=""; $folder = $list.ParentWeb.GetFolder($web.Url + "/" + $list.RootFolder.Url + "/" + $foldername) foreach ($item in $folder.Files) { Write-Host $item.Name }


1

Try this below one $Url = " http://eng.portal.cs.com"; $output = $Url.Split('/')[2];


5

use below code PS: ([System.Uri]"http://eng.portal.cs.com").Host result is: eng.portal.cs.com


5

The exact solution for your problem is that you need to import the sharepoint commands after installation. Then type the required commands to connect to the online service. You also need to be tenant admin for your office 365 environment. Pls refer the picture below with exact details.


-1

SharePoint Online Management Shell has less amount of commands than it's version for on-premise. You can read all possible commands there: https://technet.microsoft.com/en-us/library/fp161397.aspx If you want to connect to service, you have to start from this command: Connect-SPOService But you have to be a global administrator in Office 365 ...


0

Maybe this user doesn't have enough permissions to get spsite. Add him as SPShellAdmin in content database please. $db = Get-SPContentDatabase -site http://sharepoint Add-SPShellAdmin -UserName SPSP_User -database $db http://bramnuyts.be/en/2011/06/08/get-spweb-cannot-find-an-spweb-object-with-id-or-url/


0

If you want to keep on with a CAML query (as you don't know the full path of the folder, but nly its name, as you stated in the comments), try this query instead: $camlQry = "<Where> <And> <Eq> <FieldRef Name='FSObjType' /> <Value Type='Lookup'>1</Value> </Eq> ...


0

The quickest way would probably be to go to Central Administration, System Settings, and "Manage servers in this farm": then check the value in "Configuration database version" (and see the table at http://blogs.technet.com/b/steve_chen/archive/2013/03/26/3561010.aspx to know corresponding CU/SP). It may also happen that binaries of a Cumulative Update or ...


3

Nate, try the following code $web = Get-SPWeb "http://webAddress" $folderPath = "folderPath" $relativeUrl = $web.ServerRelativeUrl $folder = $web.GetFolder($relativeUrl+$folderPath) if ($folder.Exists) { Write.Host("Folder exists"); } else { Write.Host("Folder does not exists"); } Let me know if you have any questions.


3

The simplest way to check existence of a folder is the following (code not tested, may contain syntax errors, but the idea is clear): $web = Get-SPWeb "<Sub-site absolute URL>" $folder = $web.GetFolder("<absolute, or server-relative URL of the folder>") $folder.Exists


1

There are two things you should change in your script: You are using $file.Properties which are not exactly SPListItem metadata. You should use $file.Item["fieldname"] = ... To change document metadata. As it seems you are trying to set a taxonomy field that is not so straightforward. You should look,at this blog post on how to set taxonomy field using ...


0

Provided script examples and methods will work if you do not have versioning enabled in a library. Adding something like that for each item will count versions size: $versions_size = 0; foreach($v in $item.Versions) { if (!$v.IsCurrentVersion) { $versions_size += $v.FileVersion.Size; } } Note, that "current version" in Versions collection ...


0

Here is what I did So here is what I did Created ini file by following steps mentioned here Run below command $configFile = "c:\Ravi\SSRS.ini" $setupFile = "e:\setup.exe" $installCmd = "$setupFile /qs /IACCEPTSQLSERVERLICENSETERMS /ConfigurationFile=""$configFile"" /ACTION=Install" Invoke-Expression $installCmd My ini file [OPTIONS] ...


0

The good news is that there is a way to install SSRS in SharePoint (or native) mode. The bad news is that it's a little complicated. The trick is that it's done through the command line, not natively PowerShell. Here is a link regarding command line installation of SSRS 2012 in SharePoint mode. I also gather that you want to set it up in PowerShell so ...


0

This is the working code for hiding a property ##########CODE######################## # Load SharePoint.PowerShell snapin if (!(Get-PSSnapin | ?{$_.name -eq 'Microsoft.SharePoint.PowerShell'})) { if(Get-PSSnapin -registered | ?{$_.name -eq 'Microsoft.SharePoint.PowerShell'}) { Add-PSSnapin Microsoft.SharePoint.PowerShell ...


1

Issue got fixed by maintaining same time in 2 sharepoint servers and CustomSTS server. Actually one of the sharepoint server time is different from customSTS server time so, sharepoint application is treating that incoming claims are expired after login, so its again redirecting to CustomSTS server for live claims. We maintained the same time between the ...


1

Yes, that seems like a perfectly reasonable solution. The documentation for SPField.Update(boolean) even calls the boolean parameter pushChangesToLists. So if you pass $false, it should not update the lists, only the site column. So, you could potentially do something like: $web = Get-SPWeb http://vstg01 $field = $web.Fields["Customer Initials"] ...


0

Wiki pages do not have zones; web parts are placed inline with the text content. You can either use a Web Part Page instead of a Wiki Page, or you could programmatically reference the <div> tags in your Wiki Page content.


0

You can not directly access a site collection or web in sharepoint online. Firstly you need to have context for the requested site: $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") $webUrl = Read-Host -Prompt ...


0

As per my knowledge you can not get the tenant site collection url directly. You can get it by splitting the url by .(dot) and then concatenate firstPart [https://mydevsite] + secondPart [sharepoint] + thirdPart [com]


3

Retrieving Office 365 users and SharePoint users are slightly different things. With the CSOM method you describe, you will only be able to get SharePoint users who have accessed that site, or who have been explicitly added to groups on it etc. If you want to get all of the Office 365 users in your tenancy, you need to use the Office 365 management cmdlets ...


1

I would avoid the use of user profile subtypes and organizations. Neither was fully implemented and the support for subtypes is weak.


0

It seems like, from your description, if you ran this: if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } it would have failed, because Add-PSSnapin "Microsoft.SharePoint.PowerShell" by itself failed. So I don't know why that other answer was marked as the ...


1

this error occurred due to couple of reason. when you are trying to create managed property with the same name which already exist. Or you dont have peroper permission on SharePoint Search service and DBs. Further you should check the logs during the period and see if their is any access denied or other errors.


0

The SharePoint Online PowerShell Management Shell lets you query a site and get the users of that site. Searching for the exact user will either return the user record if found or throw a User not found exception if the user doesn't exist on the site. $site = Get-SPOSite https://contoso.sharepoint.com Get-SPOUser -Site $site -LoginName jsmith@contoso.com ...


1

SharePoint CSOM request size is very limited and it cannot excess 2 MB limit and you cannot change this setting in Office 365 environment. So if you have to upload bigger files you have to use REST API. Here is MSDN reference https://msdn.microsoft.com/en-us/library/office/dn292553.aspx


2

Try: $item.BreakRoleInheritance($false,$false) You will have to specify the first parameter as False, which means all the permissions from the parent will not be copied over. See the documentation for BreakRoleInheritance .


0

I was mistaken. The Day View Sub Heading type is named CalendarDayLocation. The reason I was thrown for a loop here is because someone change the title of calendar's "Location" column to another value.


1

When you upload a file regardless of what time zone you are in SharePoint server stores it into the SQL database using the Co-ordinated Universal Time (UTC) time zone. Keep in mind SharePoint Manager uses the SharePoint API to pull all meta data. SharePoint Meta data is filtered, and set to SharePoint server settings. In the raw SQL content database we can ...


1

For SharePoint Online refer to: https://technet.microsoft.com/en-us/library/fp161387.aspx Set-SPOSiteGroup -Site http://contoso.sharepoint.com/sites/siteA -Identity "ProjectViewers" -PermissionLevelsToRemove "Full Control" -PermissionLevelsToAdd "View Only" Example 1 changes permission level of the ProjectViewers group inside site collection ...


0

Try adding the -Credential parameter with Kerberos or a username and password. This way, you authenticate with the remote server. https://technet.microsoft.com/en-us/library/hh849707.aspx


1

$site = get-spsite http://www.url.com/sites/sitecollection $site.Recyclebin | where {$_.itemtype -eq "web"} This get's all the sub-sites in a site collections recycle bin. Powershell for working with SharePoint Recycle Bin


0

In each term, there is a labels property, which stores the primary label and the synonym using the "isDefaultLanguage" flag... $TermGroupName="TermGroup" $TermSetName="TermSet" $Site="http://mysharepointsite/" [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy") $session = New-Object ...


1

It would be difficult to know the exact cause of your error without actually seeing some code or error message. One of the common reasons could be that you arent using the REST api and hence are only allowed a limited file size to upload. The article here explains how to upload using REST with Powershell. Also check out this SO question previously answered. ...


0

Disposing is nececessary to prevent the process from growing bigger and bigger in memory while lifetime because SPWeb and SPSite objects are not disposed automatically by Garbage Collector. This is necessary especially for the web server process, which runs usually quite long. However, it is not that crucial in your powershell console. Even if you do not ...


0

following script might be useful, In order to use this script, you need to have SPDisposeCheck installed on your machine. function global:Get-SPDisposeCheck { Write-Host “Recursive check current location …” $path = $PWD.Path #checking actual location recursively $Dir = get-childitem $path -recurse #all files with dll extension $List = $Dir | ...


3

Here you go: $spWeb = Get-SPWeb -Identity http://<sitecollection>/<subsite> $lList=$spWeb.Lists["<ListName>"] $spItems = $lList.GetItems() foreach($spItem in $spItems) { $spItem["Date"] = $spItem["Created"].AddYears(2) $spItem.Update() }


0

You could add your own webservice to sharepoint. You could call that service remote and process the response. But you might not have a chance to speed up the powershell-remoting-process. this does not belong to sharepoint itself.


0

I am not sure how many site collections are there in your environment but if there aren't many why don't you create site templates (without content) and then restore them in the staging environment. You can save your site as template even with the publishing feature using the following powershell command, $Web=Get-SPWeb http://Servername:port/yourSite ...


1

The following will iterate all files in the root of your style library. Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue cls $web = Get-SPWeb "https://mydms.prod.com/sites/dmsHome/" $stylelib = $web.lists["Style Library"] write-host "Title:"$stylelib.title foreach ($file in $stylelib.RootFolder.Files) { Write-Host "inside ...


0

Here's something to start with in C#: $lists = $ctx.Web.Lists $ctx.Load($Lists) $ctx.ExecuteQuery() foreach($list in $lists) { $ras = $list.RoleAssignments $ctx.Load($ras) $ctx.ExecuteQuery() foreach($ra in $ras) { $ctx.Load($ra) $ctx.ExecuteQuery() if ($ra.PrincipalId -eq $everoneUserId) { ...


0

http://khalidansari.com/2014/04/07/change-sharepoint-management-shell-default-folder/ You need to modify the Target field, not the Start in field. This is a pretty good blog on how to do this. It worked for me.


1

You create the object muser, but never initialize it. So, your comparison is always false. I would suggest inspecting the Groups property of the SPUser object. (The following is not tested since I don't have an environment handy.) $site = get-spite "{siteUrl}" $web = $site.RootWeb $user = $web.AllUsers["{domain\\user_alias}"] Foreach($group in ...


1

you can use piping to iterate through all results e.g. param( $webUrl = "http://yoursite", $groupTitle = "your group" ) clear-host function Send-Mail($to){ write-host "Sending email to $to..." $smtp = "SMTP server addresss" $from = "sharepoint@company.com" $subject = "This is a Test of HTML Email" $body = "Dear Users" ...


0

I finally realised the error message was because my admin account did not have enough rights to run the script. I've been told the clue was the "unauthorized operation..." part of the error message. When I logged in as the farm account, it worker perfectly.


1

I am not 100% sure what you are asking but just incase I am right This script will return a list of all sites, the groups and the permissions the groups have. Add-PSSnapin Microsoft.SharePoint.PowerShell $sites = get-spsite | get-spweb foreach($site in $sites) { write-host $site.URL -ForegroundColor Green $site.associatedgroups | select name, roles ...


0

I found the problem when i was using "Version"= $item.["_UIVersionString"] i got base-512 versions as Vaibhav has pointed in his answer But i am getting the correct version like 23.1 etc when i use "Version"= item["_UIVersionString"] (dot removed)


2

_UIVersionString “1” = version “0.1” _UIVersionString “2” = version “0.2” _UIVersionString “3” = version “0.3” _UIVersionString “512” = version “1.0” _UIVersionString “1024” = version “2.0” _UIVersionString “1025” = version “2.1” Example : If page version is 5.4 Then it will show 2564 5 * 512 + 4 = 2564 We call this a "base-512" counting system in ...


0

I think $item["ows__UIVersionString"] should give you what you want.



Top 50 recent answers are included