Search This Blog

Showing posts with label Sharepoint-2010. Show all posts
Showing posts with label Sharepoint-2010. Show all posts

Sunday, March 17, 2019

Download Visual Studio 2017 Offline Installer (Community / Professional / Enterprise)

AngularJS 1.7.7
-----------------------
download all scripts on below link.

https://code.angularjs.org/1.7.7/

for all
----------
https://code.angularjs.org/1.7.7/angular-1.7.7.zip

VSS 2017
---------------


step 1: download vs_professional__72920401.1548828492.exe from internet

step 2: Create setup folder C: or D: drive and map the path below command

Step 2: Opend cmd prompt and enter..

For .NET web and .NET desktop development, run:

C:\Users\JAISONA\Downloads\vs_professional__72920401.1548828492.exe --layout C:\VS2017_Professional --layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional --lang en-US

For .NET web and .NET desktop development, SharePoint -office-developer-tools run:
C:\Users\JAISONA\Downloads\vs_professional__72920401.1548828492.exe --layout C:\VS2017_Professional --layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional --lang en-US


reference :
https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/install/create-an-offline-installation-of-visual-studio.md

Wednesday, April 15, 2015

Change Sitecollection URL in SharePoint

Recently I got question from one of the interview how to change the Site collection URL.
Answer :
By default there is no way to change site collection URL in SharePoint(not sub-site) so after search in google i found the url and below step.
Read more: http://www.sharepointdiary.com/2012/07/how-to-change-site-collection-url.html

How to Change Site Collection URL in SharePoint?

To change the site collection's URL, There is no out-of-the-box user interface or direct ways. So, after making sure the destination URL's managed path is already in place and verifying the target site collection URL doesn't exist, I do this three step manual process. 
  1. Backup the Source Site collection
  2. Delete the Source Site collection (Yes, its must! we've to delete the site collection before restoring it. Otherwise you will end up in No content databases are available for this operation GUID conflict issue.)
  3. Restore the Backup with the target URL
In MOSS 2007, I used to do it with STSADM as to change site collection URL:
stsadm -o backup -url http://sharepoint.crescent.com/sites/source -overwrite -filename source.bak

stsadm -o deletesite -url http://sharepoint.crescent.com/sites/source

stsadm -o restore -url http://sharepoint.crescent.com/sites/destination -filename source.bak
Change SharePoint site collection URL using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get the Source Site Collection URL
$sourceURL = Read-Host “Enter the Source Site Collection URL:”
  
#Get the Target Site Collection URL
$targetURL = Read-Host “Enter the Destination Site Collection URL”
  
#Location for the backup file
$backupPath = Read-Host “Enter the Backup File name & location (E.g. c:\temp\Source.bak):”

Try
{
  #Set the Error Action
  $ErrorActionPreference = "Stop"

 Write-Host "Backing up the Source Site Collection..."-ForegroundColor DarkGreen
 Backup-SPSite $sourceURL -Path $backupPath -force
 Write-Host "Backup Completed!`n"

 #Delete source Site Collection
 Write-Host "Deleting the Source Site Collection..."
 Remove-SPSite -Identity $sourceURL -Confirm:$false
 Write-Host "Source Site Deleted!`n"

 #Restore Site Collection to new URL
 Write-Host "Restoring to Target Site Collection..."
 Restore-SPSite $targetURL -Path $backupPath -Confirm:$false
 Write-Host "Site Restored to Target!`n"

 #Remove backup files
 Remove-Item $backupPath
}
catch
{
 Write-Host "Operation Failed. Find the Error Message below:" -ForegroundColor Red
 Write-Host $_.Exception.Message -ForegroundColor Red
}
finally
{
 #Reset the Error Action to Default
 $ErrorActionPreference = "Continue"
}

write-host "Process Completed!"


I Love PowerShell! The above method is also applicable when you want to change the Managed Path of your site collection (both SharePoint 2007 & SharePoint 2010).

Saturday, January 31, 2015

SharePoint2010 TreeViewWebPart using Custom List


Download source : SharePoint2010TreeViewWP

 
<asp:TreeView ID="LinksTreeView" Font-Names="Arial" ForeColor="Blue" ShowExpandCollapse="true" OnTreeNodePopulate="PopulateNode"
           SelectedNodeStyle-Font-Bold="true" SelectedNodeStyle-ForeColor="Chocolate" runat="server">
       </asp:TreeView>
///////////////////////////////////////////////////////////////////////////////
protected void Page_Load(object sender, EventArgs e)
        {
          
            if (!Page.IsPostBack)
            {
                TreeNode treeNode1 = null;

                foreach (DataRow item in GetFirstLevelTree().Rows)
                {
                    // bind first level tree
                    treeNode1 = GetTreeNode(Convert.ToString(item["LevelID"]), Convert.ToString(item["LevelID"]));
                    treeNode1.Expanded = false;
                    LinksTreeView.Nodes.Add(treeNode1);
                }
            }
            LinksTreeView.CollapseAll();

        }
        /// <summary>
        /// Get Root Level
        /// </summary>
        /// <returns></returns>
        public static DataTable GetFirstLevelTree()
        {
            DataTable dtTemp = new DataTable();
            DataTable dtdistinct = new DataTable();
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite spSite = new SPSite(SPContext.Current.Web.Url))
                {
                    spSite.AllowUnsafeUpdates = true;
                    using (SPWeb spWeb = spSite.OpenWeb())
                    {
                        spWeb.AllowUnsafeUpdates = true;
                        SPList spList = spWeb.Lists.TryGetList("ProductList");
                        if (spList != null)
                        {
                            SPQuery oQuery = new SPQuery();
                            //Generating custom CAML query                                                          
                            oQuery.Query = "<OrderBy><FieldRef Name='Title'/></OrderBy>";
                            dtTemp = spList.GetItems(oQuery).GetDataTable();
                            if (dtTemp != null)
                            {
                                if (dtTemp.Rows.Count > 0)
                                {
                                    DataView dtview = new DataView(dtTemp);
                                    dtdistinct = dtview.ToTable(true, "LevelID");
                                }
                            }                          
                        } spWeb.AllowUnsafeUpdates = false;
                    } spSite.AllowUnsafeUpdates = false;
                }
            });

            return dtdistinct;
        }
        public static DataTable GetSecondLevelTree(string levelID)
        {
            DataTable dtSecondTemp = new DataTable();         
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite spSite = new SPSite(SPContext.Current.Web.Url))
                {
                    spSite.AllowUnsafeUpdates = true;
                    using (SPWeb spWeb = spSite.OpenWeb())
                    {
                        spWeb.AllowUnsafeUpdates = true;
                        SPList spList = spWeb.Lists.TryGetList("ProductList");
                        if (spList != null)
                        {
                            SPQuery oQuery = new SPQuery();
                            //Generating custom CAML query
                            oQuery.Query = "<Where><Eq><FieldRef Name='ParentID'/>" +
                  "<Value Type='Text'>" + levelID + "</Value></Eq></Where>";
                            dtSecondTemp = spList.GetItems(oQuery).GetDataTable();                          
                        } spWeb.AllowUnsafeUpdates = false;
                    } spSite.AllowUnsafeUpdates = false;
                }
            });

            return dtSecondTemp;
        }
        private static TreeNode GetTreeNode(string nodeValue,string nodeTextValue)
        {
            TreeNode treeNode = new TreeNode(nodeTextValue, nodeValue);
            treeNode.SelectAction = TreeNodeSelectAction.SelectExpand;
            treeNode.PopulateOnDemand = true;
            return treeNode;
        }
        protected void PopulateNode(Object sender, TreeNodeEventArgs e)
        {
            DataTable dtLevel2 =  GetSecondLevelTree(e.Node.Value);
            foreach (DataRow item1 in dtLevel2.Rows)
                {

                    e.Node.ChildNodes.Add(GetTreeNode(Convert.ToString(item1["ParentID"]), Convert.ToString(item1["ProductName"])));

                }
        }
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            //It will not work because as it is populateondemand
            //this call will never find node because of populateondemand
            string path = "1";//txtPath.Text;
            TreeNode foundNode = LinksTreeView.FindNode(path);
            if (foundNode == null)
            {
                // Now i am doing different way
                string selecteValuePath = path;
                string[] selectedValues = selecteValuePath.Split(LinksTreeView.PathSeparator);
                string findValueQuey = string.Empty;
                for (int counter = 0; counter < selectedValues.Length; counter++)
                {
                    string fValuePath = string.Empty; ;
                    if (counter == 0)
                    {
                        // store 1
                        fValuePath = selectedValues[counter];
                    }
                    else if (counter < selectedValues.Length)
                    {
                        // now path is 1/1.1
                        fValuePath = findValueQuey.ToString()
                            + LinksTreeView.PathSeparator
                            + selectedValues[counter];
                    }
                    //1/1.1/1.1.1/1.1.1.1
                    foundNode = LinksTreeView.FindNode(fValuePath);
                    if (foundNode != null)
                    {
                        foundNode.Expand(); //loads child node
                        foundNode.Select();
                        // stored 1
                        // stored 1/1.1
                        findValueQuey = fValuePath;
                    }
                }
            }
            else
            {
              //
            }
        }