Export Term Set to CSV File

SP2013

Hello everyone,

Today, I’ll do a little advertising for PowerShell script that I found very useful. This script allows you to export a Term Set in a csv file. Very useful to migrate the contents of term store from one environment to another!

You can find this script here: http://gallery.technet.microsoft.com/office/PowerShell-for-SharePoint-a838b5d0/view/Reviews

As a reminder, to import a csv file, just go in the term store, click on the arrow at a group level and click “Import Term Set”.

Hope this helps!

Christopher.

Items bulk deletion

SP2013

Hello everyone,

Today I will talk about the massive removal of elements in SharePoint. Several possibilities exist, but the faster is the use of a batch via PowerShell.

You can find several websites / blogs on “how to create the batch” but for those I tested, I’ve always had a little something to change.

Sample sites :

http://bramnuyts.be/2013/05/16/remove-items-from-a-huge-sharepoint-list/

http://matthewyarlett.blogspot.com/2013/07/well-that-was-fun-bulk-deleting-items.html

http://sharepointnadeem.blogspot.com/2013/01/bulk-delete-items-in-sharepoint.html

http://florent.clairambault.fr/sharepoint-clean-a-huge-document-library

(by the way, thank you to all authors for their help in understanding the operation !)

In fact it is usually in the parameter “owsfileref” that divergent versions. Some do not specify, some  yes but other ways.

For me, here is the code that I use and that works for library documents and custom list.

Warning! Pay attention to the line

$batch=”

You can see that the values ​​1.0 and UTF-8 are not quoted with a simple  but with `”. I do not know why but the simple  raises an error « Exception calling « ProcessBatchData » with « 1 » argument(s) » when running the script!


Add-PSSnapin "Microsoft.SharePoint.PowerShell"

$urlSite = “http://serverurl”

$listname = “Test”

write-host "Opening site..."

$web=get-spweb $urlSite

write-host "Opening list..."

$list=$web.lists | ? { $_.title -eq $listName}

$spQuery= New-Object Microsoft.SharePoint.SPQuery

$spQuery.ViewAttributes="Scope='RecursiveAll'";

$spQuery.RowLimit = 2000

$caml = ""

$spQuery.Query=$caml

do

{

$listItems = $list.GetItems($spQuery)

$count=$listItems.Count

$spQuery.ListItemCollectionPosition= $listItems.ListItemCollectionPosition

$batch=""

$j=0

for($j=0;$j -lt $count; $j++)

{

$item=$listItems[$j]

$command=""

$command+="$($list.ID)"

$command+="$($item.ID)"

$command+="$($web.Url)/$($item.Url)"

$command+="Delete"

$command+=""

$batch+=$command

if($i -ge $count){break}

}

$batch+=""

write-host "Sending batch..."

$result=$web.ProcessBatchData($batch)

write-host "Emptying Recycle Bin..."

$web.RecycleBin.DeleteAll()

}

while($spQuery.ListItemCollectionPosition -ne $null)

$web.Dispose()

write-host "Process finished"

Hope this helps.

Christopher.

No such host is known

SP2013

Hello everyone,

Today I’ll talk about an issue with BCS. It happened to me to see the following error message by clicking on an external list.

« Unable to render the data. If the problem persists, contact your web server adminisrator. Correlation Id: XXXXXXXX

Looking at the logs I saw a strange error message:“Possibly the host name ‘ip, port’ is invalid and it’s could not be found. The exception is System.Net.Sockets.SocketException (0X80004005): No such host is known at System.Net.Dns.InternalGetHostByName …

Weird.

The BCS was created using SharePoint Designer and I can see the tables in it, so why an error “no such host is known” via SharePoint?

After digging a while I finally found the solution. The problem came from the Secure Store! Indeed, my user account was not specified in the “Members” section of the secure store!

Explanation:

Using SharePoint Designer, I could see the connection because I specified to use the credentials stored in the secure store, but my user does not belong to the Secure Store “members”, so when I browse the list in SharePoint, it does not use these credentials!

A stupid error, but an error message, once again, not very useful …

Hope that helps

Christopher.