Since we are having issues with copy link, is there any way we can hide it?
This way we forcing users to use Copy document ID only.
You cannot hide "Copy link" option from context menu (under ... ellipses menu) in SharePoint online modern experience using OOTB capabilities.
You have to create SPFx extension (Application customizer) to inject custom CSS for hiding this. However, such DOM manipulations are not recommended by Microsoft.
However, you can hide the "Copy link" option from command bar (at the top) using JSON view command bar formatting.
Use below JSON in Format current view option under Switch view options dropdown (where you switch the library views):
{
"commandBarProps": {
"commands": [
{
"key": "copyLink",
"hide": true
}
]
}
}
Output:
We could use SharePoint Json formatting to hide some command bar buttons.
Supported buttons:
'new'
'newFolder'
'newWordDocument'
'newExcelWorkbook'
'newPowerPointPresentation'
'newOneNoteNotebook'
'newFormsForExcel'
'newVisioDrawing'
'upload'
'uploadFile'
'uploadFolder'
'open'
'share'
'copyLink'
'download'
'rename'
'copyTo'
'moveTo'
'delete'
'edit'
'comment'
'editNewMenu'
'powerBI'
'powerBIVisualizeList'
'automate'
'automateCreateRule'
'automateManageRules'
'powerAutomate'
'powerAutomateCreateFlow'
'powerAutomateSeeFlows'
'powerAutomateConfigureFlows'
'aiBuilderCreate'
'aiBuilderGoto'
'aiBuilder'
'alertMe'
'newLink'
'integrate'
'manageAlert'
'powerApps'
'powerAppsCreateApp'
'powerAppsSeeAllApps'
'powerAppsCustomizeForms'
'viewDocumentUnderstandingModels'
'versionHistory'
'openInImmersiveReader'
'classifyAndExtract'
'checkOut'
'checkIn'
'undoCheckOut'
'properties'
'pinItem'
'exportExcel'
'exportCSV'
'export'
'editInGridView'
'sync'
'uploadTemplate'
'addTemplate'
'openInOfficeOnline'
'openInOfficeClient'
'addShortcut'
'pinToQuickAccess'
'unpinFromQuickAccess'
Tested json for your reference:
{
"commandBarProps" : {
"commands": [
{
"key": "copyLink",
"hide": true
}
]
}
}
Document Link:https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-commandbar-formatting
The another 'Copy Link' button you may need to use SPFX extension to inject CSS to hide it.