ĐÀ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.

Friday, October 6, 2017

Register SharePoint 2016 Online (O365 Enterprise E3)

1)      Register SharePoint online (O365 enterprise E3) at below link:



2)      Next, enter your user ID and password


3)      Enter your phone number then click Text me


4)      Your phone will receive code, then enter code then Next

5)      Waiting to finish your registration

6)      Sign-in page: https://portal.office.com/ with your user ID and password. After sign in successful, you will see this page is setting up
 

7)      After finished to set up all, then click to Admin icon
 

8)      Admin center page here, then click to SharePoint under “Admin centers”
 

9)      This is SharePoint central admin, and list all site collections appear
 

10)   Access to first site collection (https://bbv2016.sharepoint.com), it will be displayed like below.
  

11)   Finished.

Sunday, October 30, 2016

PowerShell script for adding multiple WSP solutions

$names = get-childitem C:\WSP
foreach ($solution in $names) {Add-SPSolution -LiteralPath ("C:\WSP\" + $solution.Name) }

Wednesday, October 5, 2016

Create, Update, Delete a List Item Using COM

Using C# console


Add reference to dll: Microsoft.SharePoint, Microsoft.SharePoint.Client, Microsoft.SharePoint.Client.Runtime

For Create action:


using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BasicOperationUsingCSOM
{
    class Program
    {
        static void Main(string[] args)
        {
            string siteUrl = "http://web";
            ClientContext clientContext = new ClientContext(siteUrl);
            List oList = clientContext.Web.Lists.GetByTitle("MyCustomList");
            ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
            ListItem oListItem = oList.AddItem(itemCreateInfo);
            oListItem["Title"] = "My New Item!";
            oListItem["Description"] = "Hello World!";
            oListItem.Update();
            clientContext.ExecuteQuery();
        }
    }
}

For Update:

using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BasicOperationUsingCSOM
{
    class Program
    {
        static void Main(string[] args)
        {
            string siteUrl = "http://web";
            ClientContext clientContext = new ClientContext(siteUrl);
            List oList = clientContext.Web.Lists.GetByTitle("MyCustomList");
            ListItem oListItem = oList.GetItemById(1);
            oListItem["Title"] = "Hello World Updated!!!";
            oListItem["Description"] = "Hello World Updated!!!";
            oListItem.Update();
            clientContext.ExecuteQuery();
        }
    }
}


For Delete:

using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BasicOperationUsingCSOM
{
    class Program
    {
        static void Main(string[] args)
        {
            string siteUrl = "http://web";
            ClientContext clientContext = new ClientContext(siteUrl);
            List oList = clientContext.Web.Lists.GetByTitle("MyCustomList");
            ListItem oListItem = oList.GetItemById(1);
            oListItem.DeleteObject();
            clientContext.ExecuteQuery();
        }
    }
}


Monday, September 26, 2016

Using PowerShell to find site/subsite/list/library size in SharePoint


Size of Site collection and all subsites


#Get Size of all Sub-sites in a Site Collection
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

# Function to calculate folder size
Function CalculateFolderSize($Folder)
{
    [long]$FolderSize = 0
 
    foreach ($File in $Folder.Files)
    {
   #Get File Size
        $FolderSize += $file.TotalLength;
   
  #Get the Versions Size
        foreach ($FileVersion in $File.Versions)
        {
            $FolderSize += $FileVersion.Size
        }   
    }
 #Iterate through all subfolders
    foreach ($SubFolder in $Folder.SubFolders)
    {
  #Call the function recursively
        $FolderSize += CalculateFolderSize $SubFolder
    }
    return $FolderSize
}

 
$SiteURL = "http://yoursite"
$Site = new-object Microsoft.SharePoint.SPSite($SiteURL)
  #Array to Hold Result - PSObjects
  $ListItemCollection = @()
 
  foreach($Web in $Site.AllWebs)
  {
    $ExportItem = New-Object PSObject
    #Call function to calculate Folder Size
    [long]$WebSize = CalculateFolderSize($Web.RootFolder)
   
    #Get Recycle Bin Size
    foreach($RecycleBinItem in $Web.RecycleBin)
        {
           $WebSize += $RecycleBinItem.Size
        }
        $Size = [Math]::Round(($WebSize/1024)/1024, 2)
        Write-Host  $web.Url ":`t" $Size "MB"
        $ExportItem | Add-Member -MemberType NoteProperty -name "Web URL" -value $web.Url
        $ExportItem | Add-Member -MemberType NoteProperty -name "Web Size" -value $Size
        $ListItemCollection += $ExportItem
    #Dispose the object
    $web.dispose()
   }
  
   $ListItemCollection | Export-CSV C:\allsubsitesof.csv -NoTypeInformation

Size of Lists and Libraries include version

#Set variables
$siteURL = "http://yoursite"
$site = new-object Microsoft.SharePoint.SPSite($siteURL)

$ListItemCollection = @()
foreach ($web in $site.AllWebs)
{
  foreach ($list in $web.Lists)
   {
   $ExportItem = New-Object PSObject
           $listSize = 0
           foreach ($item in $list.items)
            {
            $listSize += ($item.file).length
            foreach($FileVersion in $item.File.Versions) 
                {
                   $listSize += $FileVersion.Size
                }               
            }
            $Size = [Math]::Round(($listSize/1024)/1024, 2)
            Write-Host  $web.Title ":`t" $list.Title ":`t" $listSize   
            $ExportItem | Add-Member -MemberType NoteProperty -name "WebTitle" -value $web.Title
            $ExportItem | Add-Member -MemberType NoteProperty -name "WebURL" -value $web.URL
            $ExportItem | Add-Member -MemberType NoteProperty -name "WebDescription" -value $web.Description
            $ExportItem | Add-Member -MemberType NoteProperty -name "List_Library_Name" -value $list.Title
            $ExportItem | Add-Member -MemberType NoteProperty -name "Size (MB)" -value $Size
        $ListItemCollection += $ExportItem
    }
   
}
$ListItemCollection | Export-CSV C:\sizeoflistsandlibrary.csv -NoTypeInformation
$Site.Dispose()

Tuesday, March 8, 2016

SharePoint 2010 get list items using list.asmx service using Jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="/Style%20Library/DownloadDocuments/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function popupCenter(title, w, h, url) {
            var url = "/SitePages/Download.aspx?ID=" + url;
            var left = (screen.width / 2) - (w / 2);
            var top = (screen.height / 2) - (h / 2);
            var win = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
            win = null;
            return false;
        }


        function GetSoapQuery() {
            var soapEnv =
                "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>ListOfDownloadDocument</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='ID' />\
                               <FieldRef Name='Title' />\
                               <FieldRef Name='LinkToDocument' />\
                               <FieldRef Name='IsShow' />\
                               <FieldRef Name='DisplayOrder' />\
                           </ViewFields> \
                        </viewFields> \
                        <query> \
                         <Query> \
                           <Where> \
                              <Eq> \
                                 <FieldRef Name='IsShow' /> \
                                 <Value Type='Integer'>1</Value> \
                              </Eq> \
                           </Where> \
                           <OrderBy> \
                               <FieldRef Name='DisplayOrder' Ascending='true'/> \
                           </OrderBy> \
                </Query> \
             </query> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";
            return soapEnv;
        }

        $(document).ready(function () {
            var soapEnv = GetSoapQuery();
            $.ajax({
                url: "http://ServerName/_vti_bin/lists.asmx",
                type: "POST",
                dataType: "xml",
                data: soapEnv,
                complete: processResult1,
                contentType: "text/xml; charset=\"utf-8\""
            });
        });


        function processResult1(xData, status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function () {
                var id = $(this).attr("ows_ID");
                /*alert("ID:" + id);*/
                var title = $(this).attr("ows_Title");
                /*alert("Title:" +title);*/
                var linkToDocument = $(this).attr("ows_LinkToDocument");
                var hyperLink = linkToDocument.split(',')[1];
                /*alert("hyperLink:" +hyperLink);*/

                /*$("#download").append('<li><p><a href="javascript:void(0);" onclick="popupCenter(&#39;myPop1&#39;,450,200,&#39;' + hyperLink + '&#39;);">' + title + '</a></p></li>');*/
                $("#download").append('<li><p><a href="javascript:void(0);" onclick="popupCenter(&#39;myPop1&#39;,450,200,' + id + ');">' + title + '</a></p></li>');
            });
        }   
 
    </script>
   
   
    <h1>List of download document</h1>
        <ul id="download">
        </ul>
    </div>

Friday, November 6, 2015

Sharepoint PowerShell List of all site collections in Web Application

$xl=New-Object -ComObject "Excel.Application"
$xl.Visible=$True
$xl.Workbooks.Add()
$ws=$xl.ActiveWorkbook.ActiveSheet
$cells=$ws.Cells
$i = 1
$sites = Get-SPSite -Limit All -WebApplication http://pc362/
foreach ($site in $sites)
{
 $cells.item($i,1)= invoke-command { $site.URL }
 $cells.item($i,2)= invoke-command { $site.Owner.UserLogin }
 $cells.item($i,3)= invoke-command { $site.SecondaryContact.UserLogin }
 $cells.item($i,4)= invoke-command { $site.WebApplication.DisplayName }
 $cells.item($i,5)= invoke-command { $site.Usage.Storage/1MB }
 $cells.item($i,6)= invoke-command { $site.ContentDatabase.Name }
 $cells.item($i,7)= invoke-command { $site.Quota.Storagemaximumlevel }
 $cells.item($i,8)= invoke-command { $site.RootWeb.SiteUsers.Count }
 $cells.item($i,9)= invoke-command { $site.Usage.Hits }
 $cells.item($i,10)= invoke-command { $site.Usage.Bandwidth }
 $i++
}

Or

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
#Configure the location for the output file
$Output="C:\Output.csv";
"Site URL"+","+"Owner Login"+","+"SecondaryContact Login"+","+"WebApplication DisplayName"+","+"Quota Limit (MB)"+","+"Total Storage Used (MB)"+","+"Site Quota Percentage Used"+","+"ContentDatabase"+","+"SiteUsers"+","+"UsageHits"+","+"UsageBandwidth" | Out-File -Encoding Default -FilePath $Output;
#Specify the root site collection within the Web app
$Siteurl="https://your web application";
$Rootweb=New-Object Microsoft.Sharepoint.Spsite($Siteurl);
$Webapp=$Rootweb.Webapplication;
#Loops through each site collection within the Web app, if the owner has an e-mail address this is written to the output file
Foreach ($Site in $Webapp.Sites)
{if ($Site.Quota.Storagemaximumlevel -gt 0) {[int]$MaxStorage=$Site.Quota.StorageMaximumLevel /1MB} else {$MaxStorage="0"};
if ($Site.Usage.Storage -gt 0) {[int]$StorageUsed=$Site.Usage.Storage /1MB};
if ($Storageused-gt 0 -and $Maxstorage-gt 0){[int]$SiteQuotaUsed=$Storageused/$Maxstorage* 100} else {$SiteQuotaUsed="0"};
$Web=$Site.Rootweb; $Site.Url + "," + $Site.Owner.UserLogin + "," + $Site.SecondaryContact.UserLogin + "," +$Site.WebApplication.DisplayName + "," +$MaxStorage+","+$StorageUsed + "," + $SiteQuotaUsed+ "," + $Site.ContentDatabase.Name+ "," + $Site.RootWeb.SiteUsers.Count+ "," + $Site.Usage.Hits+ "," + $Site.Usage.Bandwidth | Out-File -Encoding Default -Append -FilePath $Output;$Site.Dispose()};

Monday, November 2, 2015

Sharepoint designer workflow update current item from lookup list based on current lookup field

Sharepoint designer workflow update current item from lookup list based on current lookup field

1. Create new custom list "Provinces". Rename Title to ProvinceID. Create new field ProvinceName (single line of text)

2. Create new custom list Employees. Rename Title to FullName. Create new field ProvinceID lookup to list Province and return ProvinceID.  Create new field ProvinceName (single line of text)

3. Create new workflow (list workflow)

4. Insert action Update item and configure like image below. Then configure workflow setting is "start workflow automatically when an item is created" and start workflow automatically when an item is changed. Then publish workflow.

5. Create new item and leave ProvinceName

6. Workflow auto update ProvinceName.

Done.