ĐÀO TẠO DOANH NGHIỆP : SỞ KHOA HỌC CÔNG NGHỆ TỈNH ĐỒNG NAI

ENTERPRISE TRAINING: DONG NAI DEPARTMENT OF SCIENCE AND TECHNOLOGY.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

Thursday, October 22, 2015

PowerShell copy list item to another list with same structure

Insert item from source list

$web = Get-SPWeb http://yourURL
$lista =$web.Lists["Source List Name"]
$listb =$web.Lists["Target List Name"]
$items = $lista.items
foreach ($item in $items) {
write-host -foregroundcolor yellow $item["Title"]
$newitem= $listb.items.Add()
$newitem["Title"] = $item["Title"]
$newitem["MultiLine"] = $item["MultiLine"]
$newitem["Number"] = $item["Number"]
$newitem["HyperLink"] = $item["HyperLink"]
$newitem["Choice"] = $item["Choice"]
$newitem["Created"] = $item["Created"]
$newitem["Author"] = $item["Author"]
$newitem["Modified"] = $item["Modified"]
$newitem["Editor"] = $item["Editor"]
$newitem.update()
start-sleep 1
}
$web.dispose
start-sleep 10

Powershell sharepoint get item by id

$web = Get-SPWeb http://yourURL
$lista =$web.Lists["Source List Name"]
$listb =$web.Lists["Target List Name"]
$items = $lista.GetItemById(523)
foreach ($item in $items) {
write-host -foregroundcolor yellow $item["ID"]
write-host -foregroundcolor yellow $item["Title"]
start-sleep 1
}
$web.dispose
start-sleep 10

Update Item by ID

$web = Get-SPWeb http://yourURL
$lista =$web.Lists["Source List Name"]
$listb =$web.Lists["Target List Name"]
$items = $lista.GetItemById(523)
foreach ($item in $items) {
write-host -foregroundcolor yellow $item["Title"]
$newitem= $listb.GetItemById(524)
$newitem["Title"] = $item["Title"]
$newitem["MultiLine"] = $item["MultiLine"]
$newitem["Number"] = $item["Number"]
$newitem["HyperLink"] = $item["HyperLink"]
$newitem["Choice"] = $item["Choice"]
$newitem["Created"] = $item["Created"]
$newitem["Author"] = $item["Author"]
$newitem["Modified"] = $item["Modified"]
$newitem["Editor"] = $item["Editor"]
$newitem.update()
start-sleep 1
}
$web.dispose
start-sleep 10

Thanks.

Thursday, October 1, 2015

Listing All SharePoint Server Features of Web Application dynamic by power shell

Listing All SharePoint Server Features of Web Application dynamic by power shell
1. Writing the function to export all features of web application with parameter
function Get-SPFeatureActivated
{
[CmdletBinding()]
param(
    [parameter(Mandatory=$true)][string]$Url,#Input your URL of web application
    [parameter(Mandatory=$true)][string]$Path,#Input your file name which you want to export like (c:\features.csv)
    [Parameter(position = 1, valueFromPipeline=$true)]#Default para
    [Microsoft.SharePoint.PowerShell.SPFeatureDefinitionPipeBind]   
    $Identity
)#end param
    Begin
    {       
        $results = @()
       
        $params = @{}
    }
    Process
    {
        if([string]::IsNullOrEmpty($Identity) -eq $false)
        {
            $params = @{Identity = $Identity
                        ErrorAction = "SilentlyContinue"
            }
        }   

        # Get web application URL
    $webApplication = Get-SPWebApplication -Identity $Url
        foreach($webApp in $webApplication)
        {
            $results += (Get-SPFeature -WebApplication $webApp -Limit All @params |
                             % {Add-Member -InputObject $_ -MemberType noteproperty -Name Url -Value $webApp.Url -PassThru} |
                             Select-Object -Property Scope, DisplayName, Id, Url)

            # check site collection features in current web app
            foreach($site in ($webApp.Sites))
            {
                $results += (Get-SPFeature -Site $site -Limit All @params |
                                 % {Add-Member -InputObject $_ -MemberType noteproperty -Name Url -Value $site.Url -PassThru} |
                                 Select-Object -Property Scope, DisplayName, Id, Url)
                                
                $site.Dispose()

                # check site features in current site collection
                foreach($web in ($site.AllWebs))
                {
                    $results += (Get-SPFeature -Web $web -Limit All @params |
                                     % {Add-Member -InputObject $_ -MemberType noteproperty -Name Url -Value $web.Url -PassThru} |
                                     Select-Object -Property Scope, DisplayName, Id, Url)

                    $web.Dispose()
                }
            }
        }
    }
    End
    {
        $results > $Path
    }
}

2. Call function then input the value via parameter in above function

3. The result is all features is exported to csv file 
 Thanks.