Tag Archives: cheap and reliable hosting

SharePoint 2013 Hosting :: Duplicate Web Part Issue in SharePoint 2013

Today for something regarding one of the new features of SharePoint 13. There is the new attribute “ReplaceContent=TRUE” for the <File> element in <Module>.

Until SharePoint 2010, whenever we reactivate the PageLayout feature (the feature that provisions the page layouts in a master page gallery), web parts that have been added to the page layout are duplicated on the new page and we do not have a very standard solution to resolve this problem except for writing a feature receiver and removing the duplicated web parts.

ahp banner sharepoint-01
In SharePoint 2013 is the new attribute “ReplaceContent=TRUE” of the <File> element and if we use this when provisioning the page layout it overrides the existing web parts on the page layouts. So whenever we create a new page from the given page layouts, web parts are not duplicated.

    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
      <Module Name="MyPageLayouts" Url="_catalogs/masterpage" RootWebOnly="TRUE">  
        <File Path="MyPageLayouts\MyPageLayout.aspx" Url="MyPageLayouts.Intranet/MyPageLayout.aspx" Type="GhostableInLibrary" ReplaceContent="TRUE">       
    <!—- All our web parts goes here -->  
        </File>  
      </Module>

Have a look at the preceding example, I have set the ReplaceContent=”TRUE”. Because of this whenever I change, add or delete a web part in this elements.xml file and I need to reactivate the feature, the web parts on the page layouts are not duplicated but they do get overridden.

Other Usage example

I’ll like to share one more scenario related to this, I have a sandbox solution that I am deploying on Office 365. I was uploading my package file (.wsp) to the Solution Gallery and activating it. In my package I have one feature that is deploying my CSS file in the master page gallery since I do not have file system access. I had a change in CSS file, I did the change, packaged the solution, deactivated the solution first, uploaded it to the solution gallery and activated it. But my CSS changes are not reflected. Then I remembered the “ReplaceContent” attribute and I used it in the module element while provisioning the CSS file and wonder happened? It worked like a charm.

Feel free if you have some thoughts on this or please share your experience. Thanks :)

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

 

 

SharePoint 2013 – ASPHostPortal.com :: Workflow Manager Installation and Configuration

SharePoint 2013 introduced a brand new way of workflow management. Now workflow could be hosted in separate server – so scalable and reduces load on SharePoint Net Front End server. Nevertheless this introduce a new level of complexity that we need to be conscious of.

ahp_freehostSHP(1)

To utilize a windows server as workflow manager you have to install/configure Workflow Manager inside the windows server. Workflow manager is a new form of application server that host/manage workflow execution. SharePoint 2013 workflow is primarily based on .net framework 4.0. Workflow Manager is designed with Window Azure hosting in mind, but now it supports on-premise installation. If organizations now want to host the workflow on-premise they could still use Workflow Manager but in future if they desire to move to Windows Azure hosting for their workflow, the migration will likely be smoother with this Workflow Manager.

Before start installing/developing SharePoint Manager you need to know few points:

  • You should not use SharePoint ‘system account’ to test workflow. If you use ‘system account’ to develop/run workflow, the workflow will fail to run.
  • You need to make sure User Profile Service (UPS) is running and the user who is running workflow has profile in UPS. Workflow Manager use UPS under the hood.
  • Make sure App Management Service is created and running. You don’t need to configure SharePoint 2013 App settings in the server, just creating App Management service (with proxy) will do.
  • SharePoint 2013 workflow is declarative – means you can only define workflow in XML. You can’t write any C# code inside workflow as you used to do before. All your custom logic should be put outside of SharePoint, inside WCF Service. Then you will call the service from workflow to implement your custom logic in code.

To register workflow Server with SharePoint, a SharePoint site collection URL is provided (see the section Register Workflow Service with SharePoint later in the post). Apparently it seems, each and every site collection need to be registered with workflow server. But it’s not, registering a single SharePoint site  collection, will enable workflow manager for all SharePoint web applications/site collections.

Install/Configure Workflow Manager

The first step in workflow setup/configuration is to install workflow manager in the workflow server (either Web Front End or a separate server). To install the workflow Manager download it from Microsoft Site or alternatively you can download it from Web Platform Installer. The installation contains few components:

  • Workflow Manager: This is the host that runs workflows.
  • Workflow Manager Client: It contains the API to allow clients to communicate with Workflow host.
  • Workflow Tool: It needs to be installed in the development server to develop SharePoint 2013 workflow. It supports the workflow development in Visual Studio 2012.

Workflow Manager client needs to be installed in every SharePoint WFE server.

After installing Workflow Manger, you can configure workflow manager with Workflow Manager Configuration Wizard. The configuration involves two steps: Workflow Manager Configuration and Service Bus Configuration.

  • Workflow Manger Configuration (first step in the wizard) is the configuration related to work host server
  • Service Bus configuration (second step in the wizard): Service Bus is used to manage communication between Workflow Server and it’s client (so, SharePoint). Service Bus queues the income request to workflow manage, provide REST interface for Workflow Manager etc.

In workflow configuration wizard don’t use any admin or SharePoint setup user, create a new service user for workflow and use that user:

1fhbeneIf you want SharePoint Server to communicate with Workflow Server over HTTP, you can select the option shown below. But please make sure this is secure in your case. For public site, this might not be secure but in case of Local Intranet with firewall, this might be secure.

2regerhIf you want to use the same service account (as well as auto generated key for certificate), you can use so as shown below:

3grfmrmrIf you want to use the same service account (as well as auto generated key for certificate), you can use so as shown below:

Register Workflow Service with SharePoint

Once you have installed/configured Workflow Server, you need to register the workflow service to SharePoint Server. The registration depends on how the SharePoint and Workflow server is connected to each other. You can find more details at technet site. The workflow manager creates an HTTPS endpoint at port 12291 and HTTP port at 12290. If you use HTTP for communication you need to provide ‘AllowOAuthHttp’ switch in the PowerShell command. The PowerShell command looks like below:

Communication over HTTP

Register-SPWorkflowService –SPSite http://sharepointsite –WorkflowHostUri http://workflowhost:12291 –AllowOAuthHttp

Communication over HTTPS

Register-SPWorkflowService –SPSite http://sharepointsite –WorkflowHostUri https://workflowhost:12290

PowerShell Script to Install/Configure Workflow Manager

I have modified the wizard-generated PowerShell script a bit to make it more reusable. The Script reads configuration values from xml file and apply the configuration. The script uses auto-generate key for certificate. Also the database name are hard-coded in the script, but you can add prefixes (like dev, test, prod) to the database from xml file. The script also configure App Management Service, if the service is not already created. The sample PowerShell Script is provided below:

#Get current user full login name
$CurrentUserLoginName=[Environment]::UserName + '@' + [Environment]::UserDomainName;
#Get current server fully qualified domain name
$HostFQDN="$env:computername.$env:userdnsdomain";

#Load SharePoint Snapin
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ){  
    Add-PsSnapin Microsoft.SharePoint.PowerShell
}

#Get DB Connection String
function GetDBConnectionString([string]$connectionStringFormat, [string]$dbPrefix, [string]$dbName){
    if($dbPrefix -ne ""){
        $dbFullName=$(GetDBName $dbPrefix $dbName);
        return [string]::Format($connectionStringFormat,$dbFullName);
        }
    else {
        return $dbName;
    }
}

#Add Dev, Test etc. environment prefix, if needed
function GetDBName([string]$dbPrefix,[string]$dbName){
    if(($dbPrefix) -and ($dbPrefix -ne "")){
        return $dbPrefix + "_" + $dbName;
    }
    return $dbName;
}

#Get current Script directory
function Get-ScriptDirectory
{
  $Invocation = (Get-Variable MyInvocation -Scope 1).Value
  Split-Path $Invocation.MyCommand.Path
}

function ConfigureWFManager([string]$settingsFile){
    [xml]$wfsettings = Get-Content $settingsFile
    $settings=$wfsettings.Settings;
    $SharePointSiteUrl=$settings.SiteUrl;
    $dbPrefix=$settings.DBPrefix;
    $CertificateKey=$settings.CertificationKey;
    $databaseServer=$settings.DBServer;
    $ConnectionStringFormat="Data Source=$databaseServer;Initial Catalog={0};Integrated Security=True;Encrypt=False";
    $RunAsAccount=$settings.WFManagerRunAsUser;
    $RunAsPasswordPlain=$settings.WFManagerRunAsPassword
    $WorkflowNamespace=$settings.WorkflowNamespace;
    if(ShouldIProvision($settings.AppManagementService))
    {
        ProvisionAppManagementService($settings);
    }

    # To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.
    # Create new Service Bus Farm
    $SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String $CertificateKey -Verbose;

    New-SBFarm -SBFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBManagementDB')  -InternalPortRangeStart 9000 -TcpPort 9354 -MessageBrokerPort 9356 -RunAsAccount $RunAsAccount -AdminGroup 'BUILTIN\Administrators' -GatewayDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBGatewayDB') -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -MessageContainerDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBMessageContainerDB') -Verbose;

    # To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.

    # Create new Workflow Farm
    $WFCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String $CertificateKey -Verbose;


    New-WFFarm -WFFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFManagementDB') -RunAsAccount $RunAsAccount -AdminGroup 'BUILTIN\Administrators' -HttpsPort 12290 -HttpPort 12291 -InstanceDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFInstanceManagementDB') -ResourceDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFResourceManagementDB') -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

    # Add Service Bus Host
    $SBRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String $RunAsPasswordPlain -Verbose;


    Add-SBHost -SBFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBManagementDB') -RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -Verbose;

    Try
    {
        # Create new Servie Bus Namespace
        New-SBNamespace -Name $WorkflowNamespace -AddressingScheme 'Path' -ManageUsers $RunAsAccount,$CurrentUserLoginName -Verbose;

        Start-Sleep -s 90
    }
    Catch [system.InvalidOperationException]
    {
    }

    # Get Service Bus Client Configuration
    $SBClientConfiguration = Get-SBClientConfiguration -Namespaces $WorkflowNamespace -Verbose;

    # Add Workflow Host
    $WFRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String $RunAsPasswordPlain -Verbose;


    Add-WFHost -WFFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFManagementDB') -RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration $SBClientConfiguration -EnableHttpPort  -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

    Write-Host "Registering workflow host (HTTP) to site: $SharePointSiteUrl";
    Register-SPWorkflowService –SPSite $SharePointSiteUrl –WorkflowHostUri $("http://$HostFQDN" + ":12291") –AllowOAuthHttp
}

function ProvisionAppManagementService([System.Xml.XmlNode] $settings){

    $appManagementServices=Get-SPServiceApplication | Where-Object { $_.GetType().ToString() -eq "Microsoft.SharePoint.AppManagement.AppManagementServiceApplication"}
     If($appManagementServices -ne $null)
     {
         Write-Host "An App Managemetn service is already running. Returning.." -ForegroundColor Yellow
        return;
     }    
    
    Write-Host "Provisioning App Management Service";
    $appManagementService=$settings.AppManagementService;
    $appPool=$(GetAppPool $appManagementService)
    $dbName=$(GetDBName $settings.DBPrefix $appManagementService.DBName);
    $appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPool -Name $appManagementService.Name -DatabaseName $dbName
    New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
}

function GetAppPool([System.Xml.XmlNode] $appManagementService){
    $pool = Get-SPServiceApplicationPool -Identity $AppManagementService.AppPoolName -ErrorVariable err -ErrorAction SilentlyContinue
    If ($err) {
        # The application pool does not exist so create.
        Write-Host -ForegroundColor White " - Getting $($appManagementService.ManagedAccountUserName) account for application pool..."
        $managedAccount = (Get-SPManagedAccount -Identity $appManagementService.ManagedAccountUserName -ErrorVariable err -ErrorAction SilentlyContinue)
        If ($err) {
            If (($appManagementService.ManagedAccountPassword -ne "") -and ($appManagementService.ManagedAccountPassword -ne $null)) 
            {
                $appPoolConfigPWD = (ConvertTo-SecureString $appManagementService.ManagedAccountPassword -AsPlainText -force)
                $accountCred = New-Object System.Management.Automation.PsCredential $appManagementService.ManagedAccountUserName,$appPoolConfigPWD
            }
            Else
            {
                $accountCred = Get-Credential $appManagementService.ManagedAccountUserName
            }
            $managedAccount = New-SPManagedAccount -Credential $accountCred
        }
        Write-Host -ForegroundColor White " - Creating applicatoin pool $($appManagementService.AppPoolName)..."
        $pool = New-SPServiceApplicationPool -Name $appManagementService.AppPoolName -Account $managedAccount
    }
    return $pool;
}

Function ShouldIProvision([System.Xml.XmlNode] $node)
{
    If (!$node) {Return $false} # In case the node doesn't exist in the XML file
    # Allow for comma- or space-delimited list of server names in Provision or Start attribute
    If ($node.GetAttribute("Provision")) {$v = $node.GetAttribute("Provision").Replace(","," ")}
    ElseIf ($node.GetAttribute("Start")) {$v = $node.GetAttribute("Start").Replace(","," ")}
    ElseIf ($node.GetAttribute("Install")) {$v = $node.GetAttribute("Install").Replace(","," ")}
    If ($v -eq $true) { Return $true; }
    Return $false;
}

Write-Host "Configuring WF Manager"
$location=Get-ScriptDirectory
ConfigureWFManager "$location\WFFarmSettings.xml"

The following XML file provides the input settings for the above PowerShell script (named as WFFarmSettings.xml in the above PowerShell script). Though you will use a site collection to register the workflow and SharePoint communication, I’ve found that workflow work for all others site collections/web application in the SharePoint Server.

<Settings>
  <SiteUrl>http://siteulr</SiteUrl>
  
  <!--Delete DBPrefix tag, if you don't want any prefix-->
  <DBPrefix>DEV</DBPrefix>
  
  <!--Key used to generate certificates-->
  <CertificationKey>CertificationKey</CertificationKey>
  
  <!--Database server name, database names are hardcoded in powershell-->
  <DBServer>DBServer</DBServer>
  
  <!--Format should be USERNAME@DOMAIN-->
  <WFManagerRunAsUser>user@domain</WFManagerRunAsUser>
  <WFManagerRunAsPassword>Password</WFManagerRunAsPassword>

  <!--dot (.) not allowed-->
  <WorkflowNamespace>WorkflowNamespace</WorkflowNamespace>
  
  <!--To work with workflow, app management service need to be provisioned-->
  <AppManagementService Provision="true">
    <Name>App Management Service Application</Name>
    <DBName>AppManagementServiceDB</DBName>
    <!--If managed account already exists with the same name, the existing one will be used-->
    <ManagedAccountUserName></ManagedAccountUserName>
    <ManagedAccountPassword></ManagedAccountPassword>
    <AppPoolName>App Management Service App Pool</AppPoolName>
  </AppManagementService>
</Settings>

					

SharePoint 2013 Hosting With ASPHostPortal :: How to Use Microsoft SharePoint Workspace Mobile

ahp_freehostSHP(1)With SharePoint Workspace Mobile, you can open, edit, and save Microsoft Office documents that are on a SharePoint 2013 site or on SharePoint Online sites, which are available with Microsoft Office 365. Just go to the Office Hub to get started.

Notes

  • Unless your organization uses a Microsoft Forefront Unified Access Gateway (UAG) server, you can only access a SharePoint 2013 site if you’re in the office and connected to your organization’s Wi-Fi network. For more info, see Connect to a Wi-Fi network.
  • You can access documents that are on a SharePoint Online site at any time and from any location by using your phone’s cellular data connection or any Wi-Fi connection that lets you connect to the Internet.

To open a SharePoint site for the first time on your phone

  1. On Start, flick left to the App list, and then tap Office .
  2. Flick to Locations, and then tap SharePoint.

If you already signed in on your phone with an email account that you have as part of Microsoft Office 365 and your plan includes SharePoint Online, your SharePoint team site will already appear in Locations. Just tap the team site to open it.

  1. Next to https://, type the address for a SharePoint site, document library, list, or folder, and then tap Go .

If you have an Exchange email account set up on your phone, SharePoint will try to use that user name and password information to sign in to the SharePoint site. If you don’t have one set up on your phone, you’ll be prompted to enter your user name and password.

  1. If you’re prompted to sign in, do one of the following:
    • If the Microsoft Office 365 sign-in page appears, type your user ID in the corresponding box, type your password in the Password box, and then tap Sign in.
    • If the Site screen displays, tap the User name box, and type your user name. Type your password in the Password box, tap Domain, and then type the domain for your account. For example, if you log on as “domainName/user” at work, you’d type domainName. Tap Done.
  2. Tap More > Bookmark this link > OK in the Link added screen to bookmark the link for later.

Note

To open another SharePoint site or location later on, flick to Locations in the Office Hub, and then tap New . On the Open URL screen, type the SharePoint site address, and then tap Go .

To browse a SharePoint site

  1. In the Office Hub, flick to Locations.
  2. Tap the SharePoint site, document library, list, or folder that you want to browse.
  3. Tap Up to go up one level in the SharePoint site.
  4. To open the SharePoint site in your phone’s web browser, tap More > Open in browser.

To search the SharePoint site for a document

  1. In the Office Hub, flick to Locations.
  2. Tap the SharePoint site, document library, list, or folder that you want to search.
  3. To search the current view for a document, tap Search . In the Search box, start typing the document name, and then tap the document when you see it.
  4. If no matches are found in the current view, tap Search for documents on to search for the document on the SharePoint site.
  5. Tap the document to open it on your phone.

To open, edit, and save changes to an Office document on a SharePoint site

From your phone, you can open and edit any Office file stored on a SharePoint site.

  1. In the Office Hub, flick to Locations.
  2. Tap the SharePoint site, document library, list, or folder that has the document that you want to open and edit.
  3. Tap the document that you want to open.

A copy is downloaded to your phone.

  1. Make and save your changes as you normally would.

The changes you make will be saved on the SharePoint site. Other people in your company or organization can then open the same version of the document that you modified.

  1. Press the Back button to return to SharePoint Workspace Mobile.

To connect to a SharePoint 2013 site from outside your company’s network

If your organization uses a UAG server, you can connect to a SharePoint 2013 site when you’re away from the office by using either Wi-Fi or your phone’s cellular data connection. To do this, you’ll first need to configure the UAG server settings on your phone.

  1. On Start, flick left to the App list, tap Settings > Applications > Office.
  2. Tap UAG server.
  3. On the UAG server screen, do the following, and then tap Done:
    • In the UAG server address box, type the server address, beginning with https://.
    • In the User name box, type your domain and user name. For example, if you log on to your computer using domainName\user, you would type domainName\user in the box.
    • In the Password box, type your password.

To resolve a conflict

A conflict can occur if you’re editing a document from your phone, make some changes, and then try to save your changes to the SharePoint site after someone else has also made changes to the same document. When this occurs, you need to resolve the conflict before you can save the document back to the SharePoint site.

  1. If the Can’t upload message box is still displayed, tap OK.
  2. In the Office Hub, flick to Locations, tap the SharePoint site, tap and hold the document that has the upload error underneath it, and then tap View status.
  3. Tap Resolve on the Upload status screen.
  4. On the Conflict resolution screen, do one of the following, depending on what you want to do:
    • To update the document on your phone with the latest copy from the SharePoint site, tap Replace item on phone, and then tap Refresh copy. Warning: The changes you made to the document on your phone will be lost.
    • To save a copy of the document that’s on your phone to the SharePoint site, tap Replace item on server, and then tap Refresh copy. Your copy will be saved to the SharePoint site and will overwrite the current version that’s on it.
    • To keep both versions of the document, rename your copy of the document on your phone. Tap Save as, type a file name in the File name box, and then tap Save. Sync your phone with the server so that you also have the newer version of the document from the server, and you’ll have both copies to compare on your phone.

To keep an offline copy of a document on your phone

You can make sure a copy of a document always remains on your phone by keeping it offline. When you do this, a partnership is set up between the copy on the SharePoint site and the one on your phone. If the copy on the SharePoint site is updated and you open the copy of the document that’s on your phone, you’ll be notified and can open the newer version on your phone. Likewise, you can make changes to the document on your phone and save them back to the SharePoint site.

  1. In the Office Hub, flick to Locations.
  2. Tap the SharePoint site, document library, list, or folder that contains the document that you want to keep offline on your phone.
  3. Tap and hold the document, and then tap Always keep offline.

To email a link to a SharePoint site

  1. In the Office Hub, flick to Locations.
  2. Tap and hold the SharePoint site, and then tap Send link.
  3. Tap an email account name.
  4. Add the recipient and any other information to your email, and then tap Send .

Tip

You can also tap and hold on a document library, list, folder, or document, and then tap Send link to send a link to one of these items.