Thursday, 26 November 2020

Publish InfoPath form to different SharePoint list

Using InfoPath Designer, we cannot change the publish URL, If you want to deploy the InfoPath form from one list to another list in the same site or a different SharePoint site hence you need to update the publish URL manually by updating the manifest file of the InfoPath form.

Below are the steps to UPDATE Manifest.xsf file:

  1. From the source list Open the InfoPath form using designer and go to File menu, select Save As option to save the InfoPath form. You will be saving a .xsn file.
  2. You cannot use the old form as-is, because it was bound to the list by its GUID, and the new list most likely has a different GUID.
  3. Rename the file from .xsn to .cab(Template.xsn to Template.cab).
  4. Extract the file using Winzip to a folder.
  5. Go to the extracted folder and open the file Manifest.xsf.
  6. Search for your current site/list URL and replace it with the new site/list URL.
  7. In addition to changing the site URL in this file, you will also need to change the GUID of each list referenced in the InfoPath form so that it matches the value in the target environment. To do that, search for all lines in manifest.xsf with "sharePointListID=" and change the GUID that follows.
  8. You may also need to change the GUID value(s) for content types as well. Search through the manifest.xsf file looking for non-null values following "contentTypeID=" and change them to the GUID value in the target environment as well.

Note: To find the correct GUID of the List, ContentTypeID you will need to go to the target list --> Click on "Customize in InfoPath" from list tools, and do Save As to save the InfoPath Form. Once you save the form you can change the extension to .cab and extract the CAB file. From the extracted folder you can Open the target list Manifest.xsf file in notepad and note the GUIDs of the Lists and ContentTypeID.

If you are using Modern view then you need to navigate to List Settings--> form settings and follow the same instructions.

     9. Now we have the updated manisfest file which is pointing to the new site. Now we need to make a .XSN file out of the extracted files. You can use CabMaker tool to create the .xsn file

Download the tool from : https://github.com/sapientcoder/CabMaker/releases 

    10. Now right click on .XSN file, select design & under File menu select publish. Now you would be able to see the publish URL pointing to your new site/list.

    11. Go ahead and publish the form.

If you don't have the MakeCab tool then you can create the XSN file from the extracted folder using makecab.exe from the command prompt. Below is the content of directive file(ddf.txt)

;************************************************************
; MSDN Sample Source Code MakeCAB Directive file example
;************************************************************ .OPTION EXPLICIT
; change the value of the caninet name for example myInfoPath.xsn
;***************************************************************** ;******************************************************************
; change the value of the Disk Directory Template value to the directory you want to store the xsn file into,,
.Set CabinetNameTemplate=NewTemplate.XSN ;**********************************************************************************************
;********************************************************************************************** .set DiskDirectoryTemplate="C:\Users\Liakath\Documents\InfoPath" .Set Cabinet=on .Set Compress=on
"C:\Users\Liakath\Documents\InfoPath\Template\Audit Results5.xsd"
;******************************************************* ; Just List All the files to be added in the xsn file ;******************************************************* "C:\Users\Liakath\Documents\InfoPath\Template\Audit Results6.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\Choices Data Connection.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\Audit Results7.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Audit Results8.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Audit Results9.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\choices.xml"
"C:\Users\Liakath\Documents\InfoPath\Template\Close.xsl" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo10.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo11.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo12.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo13.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo9.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo14.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo15.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo6.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo7.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\EmpInfo8.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\FormTypeSelection.xsl"
"C:\Users\Liakath\Documents\InfoPath\Template\ExpenseCodes5.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\ExpenseCodes6.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\ExpenseCodes7.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\ExpenseCodes8.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\ExpenseCodes9.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypeAdmin.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\GetUserProfileByName1.xml" "C:\Users\Liakath\Documents\InfoPath\Template\GetUserProfileByName3.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\GetUserProfileByName4.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\GetUserProfileByName5.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Liability.xsl"
"C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypes1.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypeAdmin1.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypeAdmin2.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypeAdmin3.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypeAdmin4.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypes.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\Office Number Translation7.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypes2.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypes3.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\LiabRequestTypes4.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\manifest.xsf" "C:\Users\Liakath\Documents\InfoPath\Template\Office Number Translation5.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Office Number Translation6.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypes3.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\Office Number Translation8.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Office Number Translation9.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Property.xsl" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypes.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypes1.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypes2.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypes4.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\schema.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypesAdmin5.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypesAdmin6.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypesAdmin7.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypesAdmin8.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\PropRequestTypesAdmin9.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\sampledata.xml" "C:\Users\Liakath\Documents\InfoPath\Template\Save.xsl" "C:\Users\Liakath\Documents\InfoPath\Template\schema1.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\Suspended Reason6.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\schema2.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\schema3.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\schema4.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Status.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Status1.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Status2.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Status3.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Status4.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Suspended Reason5.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypes9.xsd"
"C:\Users\Liakath\Documents\InfoPath\Template\Suspended Reason7.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Suspended Reason8.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\Suspended Reason9.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\template.xml" "C:\Users\Liakath\Documents\InfoPath\Template\upgrade.xsl" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypes5.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypes6.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypes7.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypes8.xsd"
;*********************
"C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypesAdmin10.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypesAdmin6.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypesAdmin7.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypesAdmin8.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WCRequestTypesAdmin9.xsd" "C:\Users\Liakath\Documents\InfoPath\Template\WorkComp.xsl" ;********************* ; End of the File

Sunday, 22 November 2020

Enable Breadcrumb/Navigation up in SharePoint Online

SharePoint 2010 has Breadcrumb option which helps us to know in which level we are in. However this feature has been disabled in SharePoint 2013 and next versions by default. But this can be enabled in Out-Of-The-Box seatle / oslo master page. 

Connect your SharePoint Online Site using SharePoint Designer 2013 and take copy of the master page and paste it.

1. Open the master page in Advanced Mode, search for the below class and remove the style attribute. 

<div class="ms-breadcrumb-dropdownBox" style="display:none;"> 

2. Search for the tag with Id "DeltaBreadcrumbDropDown" essentially next to the preceding tag and remove the visible ="false" or change it as true.

<SharePoint:AjaxDelta id="DeltaBreadcrumbDropdown" runat="server">   <SharePoint:PopoutMenu

    Visible="false"

    runat="server"

    ID="GlobalBreadCrumbNavPopout"

    Icon="/_layouts/15/images/spcommon.png?rev=23"

3. Save the master page, Check in and Publish as Major version.

That's it. Go back to your SharePoint Site and refresh it. You should have a BreadCrumb in the top navigation bar.

Before the masterpage change


After the Master page change

How to upload the SharePoint 2010 site template in SharePoint Online

Moving site templates between different versions, such as SharePoint 2010 to SharePoint 2013, is not supported. Moving between SharePoint Servers 2013, 2016, and 2019 should work. 

You will get below error when you try to upload/activate the SharePoint 2010 template/solution in SharePoint Online version.

In order to export the site with content, navigate to Site Settings in SharePoint and click “Save site as a template”. 

Remember to check off "Include Content" before hitting OK to be sure you include the content. If you have a lot of content and want to do a dry-run first, then you can skip including the content the first time around.

Note: If you don't have the ability to save the site as template then below reasons why you can not save site as template.
a. You have publishing feature enabled
b. Custom script is not allowed in tenant level(applies to SPO)
c. You have group connected site or communication site.

To allow custom scripts, you need to run the below script using SharePoint Online Management Shell:
$AdminCenterURL = "https://tenant-admin.sharepoint.com/"
$SiteURL="https://tenant.sharepoint.com/Sites/url"

#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Disable DenyAddAndCustomizePages Flag
Set-SPOSite $SiteURL -DenyAddAndCustomizePages 0

It can take up to 24 hours before the setting is enabled. After this you should be able to save as a template. or you can directly access this using below URL:

http://tenant.sharepoint.com/sites/url/_layouts/_savetmpl.aspx

Once you save the site as template, you can download it from the solution gallery..

Click the name of the package to save it on your local computer.

Now we have the downloaded solution package which is a 2010 version and it is not compatible as a 2013 site template in SharePoint Online.However we make the package compatible with SharePoint Online by changing the UI Version from the Onet.xml file by extracting the solution file.
  1. Change the extension of the solution package from WSP to CAB and extract is using 7-zip or winrar.
  2. Open the Onet.xml file into text editor from WebTemplate folder.
  3. The first row of he file will look something like below.
<Project Title="ProjectTemplate111120" Revision="0" UIVersion="4" EnableMinimalDownload="FALSE" SiteLogoUrl="" SiteLogoDescription="" xmlns="http://schemas.microsoft.com/sharepoint/">

Change the UIVersion number 4 to 15.

<Project Title="ProjectTemplate111120" Revision="0" UIVersion="15" EnableMinimalDownload="FALSE"  SiteLogoUrl="" SiteLogoDescription="" xmlns="http://schemas.microsoft.com/sharepoint/">

Now we are good to packing up the previously extracted to a new WSP file. You can use CabMaker, to create the WSP file.
Download the CabMaker from here

Upload the solution to SharePoint Online:

Navigate to the site collection in SharePoint Online you want to provision the site, and once again navigate to the Solution Gallery from Site Settings. Upload your solution and make sure it’s activated.

Note: If you see any error like "Missing site collection feature IDs" then please activate them using the below PowerShell. In case if the reported features are not important for the solution and the quick fix is going back to Onet.xml, finding the referred GUID’s and remove the entries/lines from the file. Once saved you have to go back and re-create the CAB/WSP file and upload the new one.

#  -> $sUserName: User Name to connect to the SharePoint Online Site Collection.

#  -> $sPassword: Password for the user.

#  -> $sSiteColUrl: SharePoint Online Site Collection

#  -> $sFeatureGuid: GUID of the feature to be enabled     

    $host.Runspace.ThreadOptions = "ReuseThread"     

    #Definition of the function that allows to enable a SPO Feature
    function Enable-SPOFeature
    {
        param ($sSiteColUrl,$sUserName,$sPassword,$sFeatureGuid)
        try
        {    
            #Adding the Client OM Assemblies        
            Add-Type -Path "F:\microsoft.sharepointonline.csom.16.1.8412.1200\lib\net45\Microsoft.SharePoint.Client.dll"
            Add-Type -Path "F:\microsoft.sharepointonline.csom.16.1.8412.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll"

            #SPO Client Object Model Context

            $spoCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl) 

            $spoCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($sUsername, $sPassword)  

            $spoCtx.Credentials = $spoCredentials      

            Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green

            Write-Host "Enabling the Feature with GUID $sFeatureGuid !!" -ForegroundColor Green

            Write-Host "----------------------------------------------------------------------------"  -foregroundcolor Green

            $guiFeatureGuid = [System.Guid] $sFeatureGuid

            #############################################

            # todo: change object: $spoSite=$spoCtx.Site | $spoSite=$spoCtx.Web

            $spoSite=$spoCtx.Site

            # todo: change scope: [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None | Farm | Site | Web

            # https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.featuredefinitionscope.aspx?f=255&MSPPError=-2147217396

            $spoSite.Features.Add($sFeatureGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)

            #############################################

            $spoCtx.ExecuteQuery()

            $spoCtx.Dispose()
        }
        catch [System.Exception]
        {
          write-host -f red $_.Exception.ToString()   
        }    
    }

    #Required Parameters

    $sSiteColUrl = "https://tenant.sharepoint.com/sites/SharePointMigration/"

    $sUserName = "liakathali.mohammed@doman.com"

    $sFeatureGuid= "c6561405-ea03-40a9-a57f-f25472942a22"

    $sPassword = Read-Host -Prompt "Enter your password: " -AsSecureString 

    Enable-SPOFeature -sSiteColUrl $sSiteColUrl -sUserName $sUserName -sPassword $sPassword -sFeatureGuid $sFeatureGuid

Once you activate the missing features, you should be able to see the newly installed below the Custom tab for the template selection.

Monday, 27 April 2020

Enable incoming mails in SharePoint Online

In SharePoint 2010, 2013 and 2016, When incoming emails are enabled, SharePoint sites can receive and store email messages and attachments in lists and libraries. And this Incoming email feature is available only in SharePoint Server 2016 and earlier versions of SharePoint Server, and this has been deprecated as of SharePoint Server 2019 and SharePoint Online. 

Alternate Solution: 

SharePoint Online does not have email enabled lists like on-prem SharePoint has. We have to use a work around using other Office 365 apps to create a similar functionality. A Office 365 email address has to be added to the To or CC line so the email can be sent to the Office 365 mailbox. The email will be filtered to a sub folder based on certain criteria (e.g. sender). We then use Microsoft Flow to grab the attachment(s) and move them to the desired folder on your SharePoint Online site. 

Microsoft Flow:

We can make use of Power Automate(Flow) to create a simple flow which will read mails from a Shared Mailbox in Exchange Online, get the attached documents and upload those in the SharePoint Online document library. 

Shared Mailbox vs User mailbox: 

Shared Mailbox accounts:
  • Shared mailbox do not require O365 license.
  • These accounts are disabled by default and not designed for direct logon into AD/Azure with no license but mailbox-enabled.
  • This account will not get resolved in SharePoint.

Note: If you are using SharePoint Designer workflow: Check if your workflow was created using 2013 template, If so, please create the same workflow in 2010 template and verify the logic. You will not be able to send an email to Shared mail box account using SPD 2013 template.

User mailbox accounts:
  • We can call it as non-human id mailbox accounts.
  • User mailbox enabled and designed for direct logon into AD/Azure and We should be able to resolve these accounts in SharePoint so that we can grant them access. 

Create a Shared Mailbox: 
  • Create a mail enabled shared mailbox in Office 365 if you have exchange administrator(or Global) permissions if not get it done by exchange administrators.

Reset Password:
Reset password from Office 365 Admin Portal-->Active Users. 

Create Flow:
Now that we have the required mailbox and it’s password in place, lets go ahead and create our flow. 

Go to Microsoft Flow and login with your Office 365 account. This account need not be the same mailbox account.
Click on My flows and then on Create from blank template
Select flow trigger ‘When a new email arrives’ and then create the flow.

Once the connection is added, we need to configure which folder to look into the incoming mails. So, click on the folder icon next to the text box with screen tip as “mail folder to check for new emails” and select Inbox from the menu. You may also want to select Attachment and Include Attachment to Yes to ensure this flow only triggers when the incoming mail has any attached documents.


So now the source is set. Let’s configure SharePoint part. 

Click on New Step, and type ‘Get Email’ from search box. 

Click on Message Id box,  then click on second box (add dynamic content), under dynamic content tab in search box type Message Id which you want to map , then select your column under "When a new Email arrives" section.

Select Include Attachments should be Yes

Click on ‘New Step’, and select ‘Create File’ from search box

Select the Site URL either from drop down or just by typing it in the site URL in Site Address and then the document library in the Folder Path field and click Save Now. 

Click on File Name box,  then click on second box (add dynamic content), under dynamic content tab in search box type ‘attachments name’ which you want to map , then select your column under "Get email" section.

Click on File Content box,  then click on second box (add dynamic content), under dynamic content tab in search box type ‘attachments content’ which you want to map , then select your column under "Get email" section.

Finally add Delete Email action to delete the email from the Office 365 mailbox. 

Click on ‘Add an action’ and select ‘Delete Email ’ action. From the second box (add dynamic content), under dynamic content tab in search box type ‘Message Id’ which you want to map , then select your column under “Get email’ section.

Your Flow should be like this


Saturday, 25 April 2020

Degraded search Index partition in SharePoint

Error: "Search has encountered a problem that prevents results from being returned. If the issue persists, please contact your administrator."

For further investigation please run the below command using PowerShell as Administrator.

$ssa = Get-SPServiceApplication Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Detailed -Text

After execution, the result confirmed a problem with the Index Partition, showing the Index component with the Degraded state.

Collect Logs:
get-sploglevel | where {$_.Area -like "*Search*"} | Set-SPLogLevel -TraceSeverity VerboseEx

Run Clear-SPLoglevel on your search farm and recreate the same issue and then gather the latest 2 ULS logs from each server in the search topology from the Search farm and then review the logs.

Here are plans to fix the issue: 

Plan-1:
Reboot the index server(03). If the components are not up then look for Plan-2

Plan-2:
Restart SharePoint Search Host Controller Service in all the server in search farm – this should fix the issue in most of the cases.

Plan -3:
Clear SharePoint cache in all the SharePoint search servers in the farm and then restart search services.

Plan-4:
Resent index and start full crawl.

If the index component issue did not fixed OR If the Index component keeps getting degraded and after every 10-15 minutes or so and then it recovers then proceed with the last plan.

Plan 5: If the index component status is intermittent failure then this will interfere with the sync process on other index server(04).

  • Login to the degraded status index server 03 server
  • Stop SharePoint Search Host Controller Service
  • Stop timer service
  • Delete these 3 folders (indexmeta, journel, ms) in two partitions under the path below. I:\indexinternal\Index0\SP1e52c35718bb.1.I.1.0 I:\indexinternal\Index1\SP1e52c35718bb.1.I.1.0

  • Login to 04 server
  • Stop host controller
  • Stop timer service
  • Delete these 3 folders (index meta, journal, ms) under the path below.
  •       I:\index\Index0\SP1e52c35718bb.1.I.1.0
  •       I:\index\Index1\SP1e52c35718bb.1.I.1.0
  • Start search host controller and timer service on both 03 &04
  • the 3 folders are provision on the path above on Index 0 & 1
  • we can see the folders then we go to UI and do the Index Reset
  • Start the full crawl on a content source and we can see success crawl log 
  • All the search components are should in healthy status.