Share Point

  • Published on
    20-Nov-2014

  • View
    633

  • Download
    0

Embed Size (px)

DESCRIPTION

SetFocus SharePoint portfolio

Transcript

<ul><li> 1. SharePoint Portfolio Jim Bello [email_address] 610-954-0443</li></ul> <p> 2. Table of Contents </p> <ul><li>Introduction </li></ul> <ul><li>Project Specification Overview </li></ul> <ul><li>Projects Tasks - SP Admin - SP Development - SP Business Processes - SP Portals </li></ul> <p> 3. Introduction </p> <ul><li>This project is for a fictitious towing services company called ACME, Inc. </li></ul> <ul><li>The project will design and establish a SharePoint application to support the companys towing providers. </li></ul> <p> 4. Project Specification Overview </p> <ul><li>ACME Inc. is a large towing services company.</li></ul> <ul><li>On their intranet they would like the ability to share sales decks amongst their sales personnel where a sales person may modify a sales presentation based off existing content.</li></ul> <ul><li>They would also like to establish a shared calendar on their intranet site that would integrate into Outlook.</li></ul> <ul><li>They would like to establish an area to publish a monthly news letter. A newsletter should be readable by anyone in the organization; its contributed by authors and reviewed/published by editors.</li></ul> <ul><li>Lastly ACME would like to establish a shared area for contacts. Establish a contacts list utilizing a custom list and utilizing the Microsoft Application template for contact management. </li></ul> <p> 5. Project Goals </p> <ul><li>Create an intranet solution based on SharePoint Server 2007. </li></ul> <ul><li>Branded with a unique design. </li></ul> <ul><li>Shared calendar with integration into Outlook. </li></ul> <ul><li>Shared are for contacts list utilizing Microsoft Application template for contact management. </li></ul> <ul><li>Share sales decks amongst their sales people where a sales person may customize a presentation based off of existing content. </li></ul> <ul><li>Monthly Newsletter CMS site implementing out of box workflow for approval process </li></ul> <ul><li>A dashboard to display the total dollar amount of un-invoiced Purchase orders, Total dollar amount of unpaid invoices, Total PO amount that have been submitted. </li></ul> <ul><li>Extend the solution to the Internet with sub-site creation for each provider. </li></ul> <p> 6. SP Admin </p> <ul><li>Objectives </li></ul> <ul><li>Create a new Site Collection for Acme Inc. Solution Portal </li></ul> <ul><li>A Solution Site Template </li></ul> <ul><li>A Developer Knowledge Base </li></ul> <ul><li>Enable SharePoint features to provide additional functionality to a site collection </li></ul> <ul><li>Content Deployment </li></ul> <ul><li>Configure SharePoint Services </li></ul> <ul><li>Configure user groups and permissions </li></ul> <p> 7. SP Development </p> <ul><li>Objectives </li></ul> <ul><li>Create custom metadata to track information about a solution </li></ul> <ul><li>Setup the development environment to create and deploy solutions to the farm </li></ul> <ul><li>Change the look and feel of the solution site </li></ul> <ul><li>Create a content query Web Part to view all Solution list items </li></ul> <ul><li>Create a custom Web Part to allow managers to create new SharePoint solution sites </li></ul> <ul><li>Create a custom web part to viewall Solution sites using SharePoints versions of GridView and DataSource controls </li></ul> <ul><li>Create a Search Center </li></ul> <ul><li>Modify the Advanced Search page to search by SiteTemplate column. </li></ul> <ul><li>Use Search Web Parts to display helpful information on Solutions elsewhere in the Solution Portal </li></ul> <p> 8. SP Business Processes </p> <ul><li>Objectives </li></ul> <ul><li>Create custom workflows using Visual Studio 2008 and SharePoint Designer </li></ul> <p> 9. SP Portals </p> <ul><li>Objective </li></ul> <ul><li>Create a form and list that managers can use to submit Change Management requests for a solution. </li></ul> <ul><li>Manage portals using Document and Record Centers </li></ul> <ul><li>Control the layout of the portal using publishing features </li></ul> <p> 10. Additional Project Content </p> <ul><li>Created custom content including master pages, page layouts and custom search </li></ul> <ul><li>Worked with the Business Data Catalog, used Excel Services and Forms Services </li></ul> <ul><li>Worked with the Reporting Center, Information Management Policies and Dashboard with KPIs </li></ul> <p> 11. Acme Branding Feature 12. ACME Home Page 13. Purchase Orders List 14. ACME Purchase Order InfoPath Form </p> <ul><li>Custom form features </li></ul> <ul><li><ul><li>Required fields enforced </li></ul></li></ul> <ul><li><ul><li>Document name based on Ref Number + date + Last Name </li></ul></li></ul> <ul><li><ul><li>States pulled from db </li></ul></li></ul> <ul><li><ul><li>Venders info pulled from Vender list </li></ul></li></ul> <ul><li><ul><li>Charge field value calculated from distance and Vender towing rate </li></ul></li></ul> <p> 15. Invoice Forms List 16. ACME Invoice InfoPath Form </p> <ul><li>Acme Invoice Form </li></ul> <ul><li><ul><li>Required fields enforced </li></ul></li></ul> <ul><li><ul><li>Document name based on Invoice Number + Invoice Date </li></ul></li></ul> <ul><li><ul><li>Venders info pulled from Vender list </li></ul></li></ul> <p> 17. Create Vender Webpart </p> <ul><li>Create Vender Webpart </li></ul> <ul><li><ul><li>Creates a newvender site using a custom site template </li></ul></li></ul> <ul><li><ul><li>Creates an entry in the Vender list including a hyperlink to the site </li></ul></li></ul> <ul><li><ul><li>Creates a table and controls through code behind </li></ul></li></ul> <p> 18. Create Vender Webpart </p> <ul><li>private HtmlTable CreateFormTable() </li></ul> <ul><li>{ </li></ul> <ul><li>HtmlTable table = new HtmlTable(); </li></ul> <ul><li>table.Width = "100%"; // width set on page through webpart </li></ul> <ul><li>#region Site Name Row </li></ul> <ul><li>HtmlTableCell SiteNameCell = new HtmlTableCell(); </li></ul> <ul><li>Literal SitetNameLiteral = new Literal(); </li></ul> <ul><li>SitetNameLiteral.ID = "SitetNameLiteral"; </li></ul> <ul><li>SiteNameCell.Width = "30%"; </li></ul> <ul><li>SiteNameCell.Align = "right"; </li></ul> <ul><li>SitetNameLiteral.Text = "Site Name: "; </li></ul> <ul><li>SiteNameCell.Controls.Add(SitetNameLiteral); </li></ul> <ul><li>HtmlTableCell SiteNameTextBoxCell = new HtmlTableCell(); </li></ul> <ul><li>SiteNameTextBoxCell.Controls.Add(SitetNameTextBox); </li></ul> <ul><li>HtmlTableRow SitetNameRow = new HtmlTableRow(); </li></ul> <ul><li>SitetNameRow.Cells.Add(SiteNameCell); </li></ul> <ul><li>SitetNameRow.Cells.Add(SiteNameTextBoxCell); </li></ul> <ul><li>table.Rows.Add(SitetNameRow); </li></ul> <ul><li>#endregion </li></ul> <ul><li>#region Vender Description row </li></ul> <ul><li>HtmlTableCell VenderDescriptionCell = new HtmlTableCell(); </li></ul> <ul><li>Literal VenderDescriptionLiteral = new Literal(); </li></ul> <ul><li>VenderDescriptionLiteral.ID = "SiteDescriptionLiteral"; </li></ul> <ul><li>VenderDescriptionLiteral.Text = "Descrtiption: "; </li></ul> <ul><li>VenderDescriptionCell.Align = "right"; </li></ul> <ul><li>VenderDescriptionCell.Controls.Add(VenderDescriptionLiteral); </li></ul> <ul><li>HtmlTableCell VenderDescriptionTextBoxCell = new HtmlTableCell(); </li></ul> <ul><li>VenderDescriptionTextBoxCell.Controls.Add(SiteDescriptionTextBox); </li></ul> <ul><li>HtmlTableRow SiteDescriptionRow = new HtmlTableRow(); </li></ul> <ul><li>SiteDescriptionRow.Cells.Add(VenderDescriptionCell); </li></ul> <ul><li>SiteDescriptionRow.Cells.Add(VenderDescriptionTextBoxCell); </li></ul> <ul><li>table.Rows.Add(SiteDescriptionRow); </li></ul> <ul><li>#endregion </li></ul> <ul><li>#region Url Row </li></ul> <ul><li>HtmlTableCell UrlCell = new HtmlTableCell(); </li></ul> <ul><li>Literal UrlLiteral = new Literal(); </li></ul> <ul><li>UrlLiteral.ID = "UrlLiteral"; </li></ul> <ul><li>UrlLiteral.Text = "Url: "; </li></ul> <ul><li>UrlCell.Align = "right"; </li></ul> <ul><li>UrlCell.Controls.Add(UrlLiteral); </li></ul> <ul><li>HtmlTableCell UrlTextBoxCell = new HtmlTableCell(); </li></ul> <ul><li>UrlTextBoxCell.Controls.Add(UrlTextBox); </li></ul> <ul><li>HtmlTableRow UrlRow = new HtmlTableRow(); </li></ul> <ul><li>UrlRow.Cells.Add(UrlCell); </li></ul> <p> 19. Create Vender Webpart (continued) </p> <ul><li>#region Rate Row </li></ul> <ul><li>HtmlTableCell RateCell = new HtmlTableCell(); </li></ul> <ul><li>Literal RateLiteral = new Literal(); </li></ul> <ul><li>RateLiteral.ID = "RateLiteral"; </li></ul> <ul><li>RateLiteral.Text = "Rate: "; </li></ul> <ul><li>RateCell.Align = "right"; </li></ul> <ul><li>RateCell.Controls.Add(RateLiteral); </li></ul> <ul><li>HtmlTableCell RateTextBoxCell = new HtmlTableCell(); </li></ul> <ul><li>RateTextBoxCell.Controls.Add(RateTextBox); </li></ul> <ul><li>HtmlTableRow RateRow = new HtmlTableRow(); </li></ul> <ul><li>RateRow.Cells.Add(RateCell); </li></ul> <ul><li>RateRow.Cells.Add(RateTextBoxCell); </li></ul> <ul><li>table.Rows.Add(RateRow); </li></ul> <ul><li>#endregion </li></ul> <ul><li>#region Blank row </li></ul> <ul><li>HtmlTableCell BlankCell1 = new HtmlTableCell(); </li></ul> <ul><li>BlankCell1.ColSpan = 2; </li></ul> <ul><li>Literal BlankLiteral = new Literal(); </li></ul> <ul><li>BlankLiteral.ID = "BlankLiteral"; </li></ul> <ul><li>BlankLiteral.Text = ""; </li></ul> <ul><li>BlankCell1.Controls.Add(BlankLiteral); </li></ul> <ul><li>HtmlTableRow BlankRow = new HtmlTableRow(); </li></ul> <ul><li>BlankRow.Cells.Add(BlankCell1); </li></ul> <ul><li>table.Rows.Add(BlankRow); </li></ul> <ul><li>#endregion </li></ul> <ul><li>#region Create Button </li></ul> <ul><li>HtmlTableCell BlankCell2 = new HtmlTableCell(); </li></ul> <ul><li>Literal BlankLiteral2 = new Literal(); </li></ul> <ul><li>BlankLiteral2.ID = "BlankLiteral2"; </li></ul> <ul><li>BlankLiteral2.Text = ""; </li></ul> <ul><li>BlankCell2.Controls.Add(BlankLiteral2); </li></ul> <ul><li>HtmlTableCell CreateSiteButtonCell = new HtmlTableCell(); </li></ul> <ul><li>CreateSiteButtonCell.Controls.Add(CreateSiteButton); </li></ul> <ul><li>HtmlTableRow CreateSiteButtonRow = new HtmlTableRow(); </li></ul> <ul><li>CreateSiteButtonRow.Cells.Add(BlankCell2); </li></ul> <ul><li>CreateSiteButtonRow.Cells.Add(CreateSiteButtonCell); </li></ul> <ul><li>table.Rows.Add(CreateSiteButtonRow); </li></ul> <ul><li>#endregion </li></ul> <ul><li>return table; </li></ul> <ul><li>} </li></ul> <p> 20. Create Vender Webpart (continued) </p> <ul><li>protected void CreateSiteButton_Click(object sender, EventArgs e) </li></ul> <ul><li>{ </li></ul> <ul><li>//// find our controls so we can work with them </li></ul> <ul><li>TextBox SiteNameTextBox = (TextBox)FindControl("SiteNameTextBox"); </li></ul> <ul><li>TextBox SiteDescriptionTextBox = (TextBox)FindControl("SiteDescriptionTextBox"); </li></ul> <ul><li>TextBox UrlTextBox = (TextBox)FindControl("UrlTextBox"); </li></ul> <ul><li>DropDownList SiteTemplatesList = (DropDownList)FindControl("SiteTemplatesListBox"); </li></ul> <ul><li>CheckBox AllowUniquePermissionsCB = (CheckBox)FindControl("AllowUniquePermissionsCBBox"); </li></ul> <ul><li>Button CreateSiteButton = (Button)FindControl("CreateSiteButton"); </li></ul> <ul><li>if (SiteNameTextBox.Text == "") </li></ul> <ul><li>return; </li></ul> <ul><li>// finally add the new site </li></ul> <ul><li>SPWeb web = SPContext.Current.Web; </li></ul> <ul><li>SPSite site = SPContext.Current.Site; </li></ul> <ul><li>SPSecurity.CatchAccessDeniedException = false; </li></ul> <ul><li>///* runs with admin privileges */ </li></ul> <ul><li>//1033 is For English Locale </li></ul> <ul><li>try </li></ul> <ul><li>{ </li></ul> <ul><li>// see what permissions a user has, normally we wouldcheck but we are running with </li></ul> <ul><li>// an elevated permission set </li></ul> <ul><li>// turn this off to test code below </li></ul> <ul><li>SPWeb webInUserContext = SPContext.Current.Web; </li></ul> <ul><li>SPSite SiteInUserContext = SPContext.Current.Site; </li></ul> <ul><li>Guid webGuid = webInUserContext.ID; </li></ul> <ul><li>Guid siteGuid = SiteInUserContext.ID; </li></ul> <ul><li>SPWebTemplateCollection templates =</li></ul> <ul><li>SiteInUserContext.GetCustomWebTemplates(1033); </li></ul> <ul><li>SPWebTemplate template =</li></ul> <ul><li>templates["vendersitetemplate.stp"]; </li></ul> <ul><li>SPSecurity.RunWithElevatedPrivileges(delegate() </li></ul> <ul><li>{ </li></ul> <ul><li>// get the site in impersonated context </li></ul> <ul><li>using (SPSite siteElevated = new SPSite(siteGuid)) </li></ul> <ul><li>{ </li></ul> <ul><li>siteElevated.AllowUnsafeUpdates = true; </li></ul> <ul><li>// get the web in the impersonated context </li></ul> <ul><li>SPWeb webElevated =</li></ul> <ul><li>siteElevated.OpenWeb(webGuid); </li></ul> <p> 21. Create Vender Webpart (continued) </p> <ul><li>SPWebCollection spSiteCol = webElevated.Webs; </li></ul> <ul><li>webElevated.AllowUnsafeUpdates = true; </li></ul> <ul><li>SPWeb newWeb = spSiteCol.Add("SiteDirectory/" + </li></ul> <ul><li>UrlTextBox.Text, SiteNameTextBox.Text, SiteDescriptionTextBox.Text,((System.UInt32)(SPContext.Current.RegionalSettings.LocaleId)),"vendersitetemplate.stp", false, false); </li></ul> <ul><li>webElevated.Dispose(); </li></ul> <ul><li>} </li></ul> <ul><li>}); </li></ul> <ul><li>SPList list = web.Lists["Vender List"]; </li></ul> <ul><li>SPFieldUrlValue url = new SPFieldUrlValue(); </li></ul> <ul><li>url.Description = UrlTextBox.Text; </li></ul> <ul><li>url.Url = SPContext.Current.Site + "/SiteDirectory/" + UrlTextBox.Text; </li></ul> <ul><li>SPListItem item = list.Items.Add(); </li></ul> <ul><li>item["Title"] = SiteNameTextBox.Text; </li></ul> <ul><li>item["Vender Name"] = SiteNameTextBox.Text; </li></ul> <ul><li>item["Vender Site"] = "http://dell2003srv/SiteDirectory/" + UrlTextBox.Text + ", " + UrlTextBox.Text; </li></ul> <ul><li>item["Towing Rate"] = RateTextBox.Text; </li></ul> <ul><li>item["Vender Description"] = </li></ul> <ul><li>SiteDescriptionTextBox.Text; </li></ul> <ul><li>item.Update(); </li></ul> <ul><li>SiteCreationResult = "Success!"; </li></ul> <ul><li>} </li></ul> <ul><li>catch (Exception ex) </li></ul> <ul><li>{ </li></ul> <ul><li>SiteCreationResult = ex.Message; </li></ul> <ul><li>} </li></ul> <ul><li>finally </li></ul> <ul><li>{ </li></ul> <ul><li>SPSecurity.CatchAccessDeniedException = true; </li></ul> <ul><li>} </li></ul> <ul><li>} </li></ul> <p> 22. Vender List 23. Purchase Order Workflow </p> <ul><li>Simple Sequential Workflow </li></ul> <ul><li>Visual Studio 2008 workflow </li></ul> <ul><li>Copies the new PO to the PO list in the vender site PO list when form is submitted </li></ul> <p> 24. Workflow Code </p> <ul><li>public Guid workflowId = default(System.Guid); </li></ul> <ul><li>public string errorMessage = string.Empty; </li></ul> <ul><li>public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties(); </li></ul> <ul><li>private void codeCopyDocToLib_ExecuteCode(object sender, EventArgs e) </li></ul> <ul><li>{ </li></ul> <ul><li>// Get the item the workflow is running on </li></ul> <ul><li>SPListItem item = workflowProperties.Item; </li></ul> <ul><li>string siteUrl = string.Empty; </li></ul> <ul><li>try </li></ul> <ul><li>{ </li></ul> <ul><li>//Get the field that contains the vender name. </li></ul> <ul><li>string name = item["Vender"].ToString(); </li></ul> <ul><li>// Set the name of the document library and site </li></ul> <ul><li>// where to copy the document to </li></ul> <ul><li>SPSite sourceSite = workflowProperties.Site; </li></ul> <ul><li>SPWeb sourceWeb = sourceSite.OpenWeb(); </li></ul> <ul><li>string[] urlArray = null; </li></ul> <ul><li>SPList list = sourceWeb.Lists["Vender List"]; </li></ul> <ul><li>for (int i = 0; i &lt; list.Items.Count; i++) </li></ul> <ul><li>{ </li></ul> <ul><li>SPListItem venderItem = list.Items[i]; </li></ul> <ul><li>if (venderItem["Vender Name"].ToString().Equals(name)) </li></ul> <ul><li>{ </li></ul> <ul><li>siteUrl = (String)venderItem["VenderRateURL"]; </li></ul> <ul><li>urlArray = siteUrl.Split(','); </li></ul> <ul><li>} </li></ul> <ul><li>} </li></ul> <ul><li>//string siteUrl = "http://vm187:100/solutions/Test"; </li></ul> <ul><li>string libName = "Purchase Orders"; </li></ul> <ul><li>if (siteUrl != null) </li></ul> <ul><li>{ </li></ul> <ul><li>siteUrl = urlArray[1]; // Open the site </li></ul> <ul><li>using (SPSite site = new SPSite(siteUrl)) </li></ul> <ul><li>{ </li></ul> <ul><li>using (SPWeb web = site.OpenWeb()) </li></ul> <ul><li>{ </li></ul> <ul><li>if (item.File != null) </li></ul> <ul><li>{ </li></ul> <ul><li>// Copy the document to the library </li></ul> <ul><li>SPFolder library = web.Folders[libName]; </li></ul> <ul><li>library.Files.Add( </li></ul> <ul><li>item.Name, item.File.OpenBinary()); </li></ul> <ul><li>library.Update(); </li></ul> <ul><li>} </li></ul> <ul><li>} </li></ul> <ul><li>} </li></ul> <ul><li>} </li></ul> <ul><li>} </li></ul> <ul><li>catch (Exception ex) </li></ul> <ul><li>{ </li></ul> <ul><li>errorMessage = ex.Message; </li></ul> <ul><li>} </li></ul>