User Profile
drmrbrewer
Copper Contributor
Joined Apr 18, 2020
User Widgets
Recent Discussions
Re: Custom CSS on a Library page
ganeshsanap wow, Microsoft really have made something that should be very simple (and yet very powerful) into something that is almost unusable (for the ordinary user). They are so close, but yet so far, with `additionalRowClass` and predefined CSS classes... very easy for the mere mortal to switch row style based on predefined classes (great!) but not realistically possible to define your own classes (crazy!)...2.3KViews0likes3CommentsRe: Custom CSS on a Library page
Rob_Elliott thanks for the response. I'd already seen those JSON examples, but don't see quite how they would apply to what I'm trying to achieve. I want a simple way just to change the background colour of the entire row, both normal and on hover. For this it seems that I need to format the View, and use the `additionalRowClass` to specify the behaviour. But that allows me only to state one or more predefined CSS class names. If I want to branch out beyond what I can get from the predefined classes, it seems that my only choice for row formatting is to use `rowFormatter`. But in that case, my understanding is that I'm now having to set out the layout and formatting of the entire row, i.e. all columns? I really don't want to go that far... I'm happy with the background colours I can get from the predefined classes, and happy with the layout of the row generally... all I want to do now is to specify that I want e.g. just the opacity of the colour to change on hover... i.e. not to switch colour completely to a grey colour as it does at present, but to keep the same colour for hover but just change the opacity or lightness or something along those lines. To me, that would most easily be achieved by being allowed to define our own CSS (in a simple way)... how can I achieve what I want via other JSON customisation, e.g. `rowFormatter`, without having to design the entire row (and update it every time I add or remove a column etc)?2.4KViews0likes5CommentsCustom CSS on a Library page
I've been using row formatting to provide custom styling to a library https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-list-formatting#apply-conditional-classes-on-rows. I've been referring to the various standard classes, such as "sp-field-severity--severeWarning" mentioned in the example. Now I'd like to go a little further, and add some custom classes of my own, mainly to tailor the hover behaviour more closely to what I want. I would expect this to be a simple case of dropping in some simple CSS code into a folder somewhere. But unless I'm missing something, it seems to be incredibly complicated to achieve... https://www.sharepointdiary.com/2020/11/add-custom-css-to-sharepoint-online-modern-page.html. Is it really that difficult? Surely it really should be a case of specifying some CSS definition like the following?? .my-hover:hover { background-color: green; }2.8KViews0likes7CommentsRe: Replace column title with an icon (or just hide title text)
Rob_Elliott it's even worse than I thought... even reducing the column name doesn't help because SharePoint seems to enforce a silly minimum column width regardless (larger than I want it to be)... I mean SharePoint allows you to do some complex stuff but sometimes it doesn't seem to let you do the simple stuff, like set the column width to what you really want it to be 😕1.2KViews0likes0CommentsRe: Replace column title with an icon (or just hide title text)
Rob_Elliott I'll take a look (if nothing else to figure out what Power Apps can do) but I think my strong preference would be to keep everything in one place (i.e. SharePoint) for usability. It seems like a bit of an oversight not to allow the column to be resized so that it's narrower than the column name? I mean, this is possible in File Explorer for example. Maybe I'll just have to resort to giving my column a one- or two-letter name (if that's possible).1.3KViews0likes1CommentFormatting to set background colour of entire cell (not just text part)
I am using custom formatting along the following lines: { "$schema": https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json, "elmType": "div", "txtContent": "@currentField", "attributes": { "class": "='ms-Link ' + if(endsWith([$FileLeafRef], '.msg'), 'sp-field-severity--good', '')" }, "customRowAction": { "action": "defaultClick" } } This works fine, except that it only changes the background colour of the text part of the cell. You can see in the following clip that, where the cell is larger (to fit content in other columns), the cell is larger than the textual content: Is it possible to specify a background colour of the entire cell, based on file extension?754Views0likes1CommentReplace column title with an icon (or just hide title text)
I have a custom column where each entry is just a small icon acting as a button to run a flow (this is done via column formatting via json). I'd like to be able to make this column not take up any more space horizontally than the buttons themselves. But I can't seem to resize the column to anything narrower than the title of the column (i.e. column name). I could rename the column use only one or two letters, but this seems like a horrible hack... the column name is used not only as the title in the UI but it's also used like a variable name in power automate flows, so it needs to be descriptive otherwise it becomes very difficult to understand the flow. Is it possible to reduce the column title name (without renaming the column), or replace it with an icon?1.5KViews0likes3CommentsRe: Format calculated column as hyperlink to navigate like the Name column
ganeshsanap genius! Very nice! I'll definitely mark this as the answer, because it does what I asked for... but for the icing on the cake: the standard Name column also has a "Share" and "Three-dot menu" that appear in the field when you hover over it, giving you more options to do stuff with that item. Since I'm trying as far as possible to create a replacement for the Name column, is there something I can add to the JSON format to add these contextual actions too?3.6KViews0likes2CommentsRe: Working with the file name
ganeshsanap I get a warning about creating an infinite loop (because updating Title will trigger the action again). What is the best way to avoid this? Ideally, the action should not trigger at all the second time (via a trigger condition), rather than triggering and then aborting.6.1KViews0likes0CommentsRe: Format calculated column as hyperlink to navigate like the Name column
ganeshsanap thanks for the reply! Your custom formatting provides the column with the click navigation functionality, but it's still not formatted as a hyperlink (to show it's clickable). Is it possible to do that, without messing up the defaultClick action? Ideally it would also be nice to have the same hover behaviour as the standard Name column, which appears as plain text (not blue underlined) until you hover over it, and then it is underlined as a hyperlink (still not blue).4.3KViews0likes4CommentsFormat calculated column as hyperlink to navigate like the Name column
I have a calculated column which is populated with content from my custom Subject column, and if that is blank then it falls back to what is in the standard Name column (or a tracked version of that, since Name is bizarrely not available as a column choice in a calculated column). Now I want that to act as a hyperlink in the same way as the Name column, I.e. to move into the folder (if it’s a folder) or open the file (if it’s a file). It’s like a substitute Name column. Is this possible?Solved5.1KViews0likes6CommentsCustom column formatting: get current folder (for hyperlink with relative path)
I am using https://www.sharepointdiary.com/2019/01/format-calculated-column-as-hyperlink-in-sharepoint-online.html as the basis for applying custom formatting to create a hyperlink from the field value. So the JSON for formatting is something like: { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "a", "txtContent": "Project Documents", "attributes": { "target": "_blank", "href": "='https://crescent.sharepoint.com/sites/projects/' + @currentField" } } In the above, @currentField is used to extract the value of the current field/column. And I see https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-syntax-reference#currentweb that it's also possible to use @currentWeb get the main site dynamically rather than hardcode it. What I really need is something similar to get the folder for the current item, so that I can for example then refer to a sub-folder relative to the current folder, rather than relative to the top level, i.e. something like @currentFolder in the below: "href": "=@currentWeb + '/' + @currentFolder + '/my-sub-folder/' + @currentField" Is this possible? Or is there a better way to construct hyperlinks like this that are relative to the current item? The problem with full hard-coded paths (like the following) is that this formatting trick won't work for any folder, only for a specific folder... "href": "=@currentWeb + '/Documents/North Dept/Team A/2023/Reports/my-sub-folder/' + @currentField" And I can't see that using an actual Hyperlink type of column would work for this, because the full path name would need to be used... because it's just a string that is interpreted as a URL? I'd really like the ability to create hyperlinks that are relative to the current folder.1.8KViews0likes0CommentsRe: Opening .msg files from sharepoint natively in Outlook
Paul de Jong thanks for the detailed and informative reply. > no support for metadata extraction (e.g. subject, sent date, ...) This is indeed a major oversight. I'm looking at a macro/flow solution which files away an email from Outlook into SharePoint, and which at the same time populates some custom fields (columns) in SharePoint with some additional metadata... including some pretty basic ones like To and From, which IMHO should not be necessary. This is 2023 and these applications are all within the MS ecosystem so it really should be a thing already. > the need to download emails to the local computer increased the compliance / security risks Yes. It would be so straightforward to implement (at the bare minimum) the ability to open the .msg file into native Outlook at the click of a button (or from a context menu), like you can with Word documents from SharePoint. It's one of the lowest hanging fruit possible in this context, surely? > here are quite some organizations that want to store emails in SharePoint together with > the related project/client data and keep relevant information together and have a > single source of truth Exactly this! We have a whole range of documents and document types, including emails, pdfs, Word, Excel and so on, and we want to keep them all in the same place, so that we can organise and tag them consistently, and filter/search to find what we want quickly. An email (.msg) file should not be treated any differently to any other type of file.11KViews0likes0CommentsRe: Opening .msg files from sharepoint natively in Outlook
I am also wondering the same thing, and it seems like a bizarre omission that you can't open an email from SharePoint into native Outlook. Even the preview you get in SharePoint is pretty rudimentary, and does not show attachments! It's not like Outlook is some esoteric third party application... it's an MS product and pretty much ubiquitous in a corporate environment. Seems odd that we need to go looking for third party solutions even to get a decent preview of an email in SharePoint.12KViews0likes2Comments
Recent Blog Articles
No content to show