How can one customise library search results from the header search box?

As announced by Microsoft and discussed in this answer, the search box in the command bar has been removed from document libraries, leaving the header bar as the only place with a search box.

SharePoint library screenshot

When launching a search from this bar, the search results appear in the same view (rather than the Microsoft Search view, which only appears if the “Expand search to all items in this site” link at the bottom is clicked”). The page that’s opened appears to be the view with a query string appended – e.g. https://sitename.sharepoint.com/sites/groupname/Test/Forms/AllItems.aspx?view=7&q=searchterm

SharePoint library search results

I’d like to customise the results to promote particular content types.

I’ve tried so far:

  • adding a new result source and setting it as the default in the Microsoft 365 Admin Center
  • adding a query rule in the site settings

Nothing has had any impact so far on the results that appear. What settings need to be altered to have an effect on these results?

sharepoint enterprise – Renaming File in Library “Invalid File Name” Error

One of my users has a simple SharePoint 2010 library where they store PDFs with some metadata. Problem is, when someone tries to rename the file, by editing the Name field, SharePoint gives an error that the new name is invalid. Strangely, once the error message is close and the page refreshed, the name has changed despite the error saying the opposite.

The same behavior occurs in Explorer View.

There are no special characters in the file names, nor is the filename too long. Versioning is disabled, checking out files is not required.

Log files:

03/29/2016 15:58:54.51 w3wp.exe (SPSTSTWF02:0x154C) 0x19CC SharePoint Foundation Database d0d6 High System.Data.SqlClient.SqlException: Arithmetic overflow error for data type tinyint, value = 256. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.HasMoreRows() at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) at System.Data.SqlClient.SqlDataReader.NextResult() at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock) 19495cb1-9004-444f-a736-265a1d3d766c

03/29/2016 15:58:54.51 w3wp.exe (SPSTSTWF02:0x154C) 0x19CC SharePoint Foundation General 8kh7 High Invalid file name. The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file. 19495cb1-9004-444f-a736-265a1d3d766c

03/29/2016 15:58:54.51 w3wp.exe (SPSTSTWF02:0x154C) 0x19CC SharePoint Foundation Runtime tkau Unexpected System.Runtime.InteropServices.COMException: Invalid file name. The file name you specified could not be used. It may be the name of an existing file or directory, or you may not have permission to access the file. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback) at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback) 19495cb1-9004-444f-a736-265a1d3d766c

sharepoint online – Extract the Name of the uploaded file in document library into another column

You cannot use a calculated column with the name column. You can build a designer workflow that runs on item creation and update the columns with data extracted from file name.

Alternatively, as you seem to be using SharePoint online you can also build a Microsoft flow to do the same.

enter image description here

To extract the first part I used the expression

substring(triggerBody()?('{Name}'), 0, lastIndexOf(triggerBody()?('{Name}'),'-'))

For the second part I used an expression

substring(triggerBody()?('{Name}'), add(lastIndexOf(triggerBody()?('{Name}'),'-'),1), sub(sub(length(triggerBody()?('{Name}')),lastIndexOf(triggerBody()?('{Name}'),'-')),1))

8 – How do I let the module know where the external library is located?

The International Phone module’s page says that Composer is required to install the module. The module doesn’t have a setting page where you can say where the library has been copied, and that is expected, from a module that requires Composer.

Composer is not a tool you normally use on a production server, and using the production server as test server is pretty wrong.

When I have to install Drupal on a shared hosting that doesn’t allow me to use SSH, I install Composer on the local computer, I use a Composer template to copy Drupal in a directory and I add the modules I need with composer require. I can then use that directory for a local site where I can verify that adding a module, or updating the site, doesn’t cause issues.

When a module requires Composer, there aren’t other ways to let it know where the libraries from which it depends have been installed.
They are loaded from the autoload.php file created from Composer. You could manually create that file, but that would be a bad idea, especially because that file is created basing on some settings present in the composer.json file that comes with Drupal core.

Get ItemChild properties using Powershell Script SharePoint 2013 document library

We have a document library which contains multiple document set we have below requirements :

  1. Get all document set properties like Name, Created Date, Modified date.
  2. Get all ItemChild (document present inside the document set) properties Name, Created Date, Modified date.

We are able to get document set properties but unable to get ItemChild properties, any lead much appreciated, Please find my below code.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

$web = Get-SPWeb "Site URL"

$list = $web.Lists("ENERGY")


foreach ($listItem in $list.Items)
{
$CabinetName = $listItem('Name')
$CabinetCreateDate = $listItem('Created')
$CabinetModifiedDate = $listItem('Modified')
$CabinetChildItemCount = $listItem('ItemChildCount')

   Write-Host "    Cabinet Name: " $listItem.Name "  Modified: " $CabinetModifiedDate "Cabinet ChildItem Count" $CabinetChildItemCount "Created Date:" $CabinetCreateDate

}
$web.Dispose ()

How can I hide a document library from search results without disabling search within the document library?

I have some document libraries that I wish to use for file archival purposes for older files that don’t need to be accessed on a daily basis, but still need to be kept for posterity. Because these files don’t need to be regularly accessed, I’d like to hide them from showing up in searches across the whole site collection, so that they don’t clog up the search.

I found a setting to disable the items in the document library from showing up in search results in the advanced settings for the document library: enter image description here

However, setting this option to “no” also disables search from working within the document library after a couple of moments. This makes it impossible to find files within search disabled document libraries when the need arises.

Is there any means of hiding the contents of a document library from a site collection wide search while still having search available within the document library?

uploads – Merge Multisites with Shared Network Media Library

So have a multisite setup which no longer needs to be a multisite but I’m left with a bit of a mess since I used Network Media Library plugin to host images for all sites on the network. I’ll try to break it down:

  • started out with WP multisite
  • created two sites on the network
  • installed Network Media Library
  • site #1 hosted the media library
  • both sites hosted posts
  • (about a year and a lot of posting goes by)
  • pulled site #1 out of multisite to be hosted independently
  • left with multisite running site #2 but still pulling it’s media from site #1

What I want to do now is combine site #2 which contains all my posts with site #1 which contains only media. My concerns are:

  • if I merge tables there will be ID conflicts (some posts will have same ID as attachments)
  • if I use import function to bring images into posts site then images will be given new IDs and post thumbnail relations will all break
  • if I use import function to bring posts into images site then post IDs would change which can’t happen because we use the ID in the post URL

The best idea I have so far is to somehow…

  • use the WordPress import function to import all the attachments into the posts site
  • log old and new IDs into a new table in the DB as the process works
  • then iterate over all the posts switching old for new IDs in the post_meta _thumbnail_id fields
  • ideally then be left with one site which contains all the posts and attachments so I can reduce the install down to regular non-multisite.

There’s tens of thousands of posts on these combined sites so performing these functions is no small feat and really not sure where to start so I wonder if anyone has any experience of a process like this or ideas for alternative solutions.

Thanks for reading.

sharepoint enterprise – REST API – Get document library properties that are in a folder of that library

When getting properties from a document library with the SharePoint API, I’m using the following call

var httpRequest = new HttpRequestMessage(HttpMethod.Get, spPath + spSubSite + "/_api/web/lists('" + spAppId + "')/items?$filter=EnvelopeId eq '" + envelopeId + "'");

For a document library, I created multiple views where I have set some view level permissions, following this link https://www.netwoven.com/2016/01/21/how-to-set-view-level-permission-for-a-listlibrary-in-sharepoint/.

When I then try to get the properties, I’m getting the following error

{“odata.error”:{“code”:”-1, System.Collections.Generic.KeyNotFoundException”,”message”:{“lang”:”en-US”,”value”:”The given key was not present in the dictionary.”}}}

Because content type was setup and a folder is created at that document library, I tried to get properties with the following code

var httpRequest = new HttpRequestMessage(HttpMethod.Get, spPath + spSubSite + "/_api/web/lists/getbytitle('ViewICLExport')/items?$filter=EnvelopeId eq '" + envelopeId + "'");

Then I got {“odata.error”:{“code”:”-1, System.ArgumentException”,”message”:{“lang”:”en-US”,”value”:”List ‘ViewICLExport’ does not exist at site with URL ‘SPSite/DigitalSignatures/InternalLimits’.”}}}

When I open a view, the URL is SPSite/DigitalSignatures/InternalLimits/Internal%20limits%20Export/ViewICLExport/Africa.aspx

So my question is, how do I get the properties of this document library with his folder?