I'm currently learning how to extend Sharepoint Online (ie Sharepoint Modern) and am not sure how to achieve the below, so any pointers would help.
We want to create a site to be used as a knowledge base for pages on specific subjects.
(as this site would only have these pages would it matter f it were a Team Site or a Communication site? I suspect it dsoesn't matter)
There will be multiple revisions to each page, but we would like to keep earlier versions and just flag which is the current one.
Example :
Page 1 : Introduction to company systems
Initially this would be created as Version 1, and be visible to all users.
Later we create a new,edited copy that is Version 2.
Both remain published but we want to make sure visiters are offered Version 2.
What we would like:
A way to flag the version number against each page. I assume this would normally be done by a column in a list of the pages eg column 'Version'?
A way to flag the page that is the current version. Again, a list column eg column 'IsCurrentVersion'?
Is there any way to edit these columns (ie 'Version' and 'IsCurrentVersion') from within the page rather than having to open the list and edit the list row? (eg Possibly using PowerApps?)
Is there a way so that when an editor flags a page as the current version, an automated process goes through all other version of that page, and sets 'IsCurrentVersion' to 'No', so only one page is ever seen as the current version? (eg using Power Automate?)
A way so that when a user views a page, it checks to see if it is the current version (eg by checking the list column 'IsCurrentVersion') and:
if it IS the current version it offers a link to a list of previous versions,
or if it IS NOT the current version, javascript adds a class to the page so it is obvious this is not the current version (eg, a tinted overlay, pseudo element watermark) and offers a link to the current verison (would this be done with spfx extensions)?
Finally, (this may not be needed) a way so that some users cann ONLY see the current version - -e if they manage to get the url to a page which is 'IsCurrentVersion' set to 'No', they can not open it, or it redirects them to the current version, or sets a class with styling to hide the content (the last option is least desirable as it it is easily overcome by the user).
I am hoping this is possible in Sharepoint, and showing me where to look for solutions would be fantastic.
Related
For years I created columns in SP in the following way:
Fix browser accept-language header to default language of site
(e.g. en-US)
Create column with an internal name
Rename column to default language name
Fix browser accept-language header to next language (e.g. de-DE)
Rename column to next language name
This worked and the translated names are still shown.
I now tried the same steps on 2 new sites on different tenants and it seems variants are not longer created: always all languages are changed.
resx files created by Site settings > Export Translations does not contain newly created fields / columns.
Was this feature removed?
If yes: what is the current way to create multilingual data-lists (one list filled by many users in different countries/languages)?
If no: has the way to translate fields / columns changed? Or is this a (temporal) bug in current SPO?
The multilingual user interface (MUI) works exactly the same way in SharePoint Online as on premise. However your browser's Accept-language is not the only thing that governs the current UI language, your profile language is another factor, and you have to wait for it to take effect.
When you change your language in order to enter the column names in a different language, check that at least some of the built-in UI, menus, edit link, etc, is in the new language. Bits of it are cached and will take a long time to be in the right language, but as soon as some of it changes, you are good to edit those column names and any untranslated navigation while you are at it.
A few times I've attempted to customize a SP2007 page using css, html, or javascript in Sharepoint Designer; however, in Sharepoint Designer I am not able to get direct access to the desired elements since they are generated by a Sharepoint Control (such as a web part or dataview) and appear only AFTER the page is rendered in the browser. I use use IE's F12 to tracked the element I wish to change. Then I can see an identifer such as name or id I can use in my javascript or css.
Example 1: SP2007 generates "name=ctl00$PlaceHolderMain$g_ba9196a9_2842_4607_b048_9a443cb4def5$ff2_1$ctl00$ctl00$BooleanField" for an input text box. I use that name to manipulate the text box as I desire.
Example 2: SP2007 generates "id=zz6_menu" for the "Welcome" text which I use to get the users full name.
So far this has worked out fine. Am I tempting fate?
Can someone refer me to a reference that discusses how these names and other Sharepoint Control element identifiers are generated?
Are they stable? Can I count on them to be the same provided the application I develop with my version of SP isn't updated to a later version of SP? And even if that case I'm thinking I can simply update to the identifiers created by the newer version of SP.
Is this a good practice? Any other comments?
All responses are welcomed.
Thanks.
SharePoint is based on ASP.NET and that's why the Ids are automatically genereated.
cf this article.
You should not use them to identify elements on css or js.
Do not write code that references controls using the value of the
generated UniqueID property. You can treat the UniqueID property as a
handle (for example, by passing it to a process), but you should not
rely on it having a specific structure.
In my opinion, the best way is to rely on the css classes because they are not automatically generated and should not change a lot.
Anyway, if you upgrade to SP2010 or 2013, lot of your modifications won't work anymore because the structure and css changed...
I have a site collection (localhost) that has two variations (localhost/en/, localhost/fr/).
I have a list in the root web (sampleList) that has the following columns: title, description, date
I have English and French pages (/en/samplePage.aspx, /fr/samplePage.aspx) that uses sampleList as a shared web part.
Is there any way of modifying the web part on the French page (perhaps through the XSL Link field on the tool part) such that I can modify the list name and the column names of the list to be displayed in French?
You should be able to do that in SP Designer. Here's a tutorial kinda what you need:
http://maulikdhorajia.blogspot.com/2011/06/sharepoint-2010-customizing.html
You'll want to edit the page in designer ("edit in advanced mode") - then do steps 7 - 10 from the link. After that, it'll be a matter of locating the references to the column names, removing them, then hard coding in new French names.
One word of caution, there's a tricky bugger related to ddwrt:ghost="hide" tags you'll see in the xslt. Wherever you make changes, you'll probably need to find the preceding ddwrt:ghost="hide" and change it to ddwrt:ghost="" - or else you'll see your changes in desiger, but not in the actual site - you can read more about that here: http://www.sharepointbandaid.com/ddwrt/
In general, I usually had trouble do this, I preferred using the content query web part instead. Also, hopefully this all makes sense, I haven't been in-front of SharePoint for awhile so I'm working from memory (which ain't what it used to be).
I have a SharePoint 2010 Foundation site that has recently been upgraded from WSS 3.0. The upgrade was completed successfully with no glitches.
However, ever since I have upgraded the site I have got a problem relating to lookup fields on the NewForm.aspx (New list entry page) on some calendar lists that were existing on the site prior to the upgrade.
The issue is that I have two lookup fields, one for Client and another for Meeting Type / Location. When I am on the NewForm.aspx (new list item entry page) and I select an entry in one of the lookup fields the second doesn’t allow me to select anything and just gives me the top value in the lookup list without offering any other alternative selections like it should. These fields are just standard SharePoint Lookup fields and are not modified in any way, nor is the page. This problem does not happen on new lists I create (with more than one lookup field in them) in the site nor does it happen if I add extra lookup fields on the existing lists, it just leaves these two fields with issues.
I have used Internet Explorers debugging tools to see if there is an error in any of the JavaScript on the page but nothing is being reported as being a problem and I have also tried rendering the page in different standards in Internet Explorer to see if it is related to the browser but these do not many any difference. One thing that is apparent though is that the values for both lookup fields are being pulled in to the HTML of the page as I can see them when viewing the HTML source of the page when it has loaded and in the Developer Tools in Internet Explorer…
If anyone has any experience of things like this and could point me in the direction of a fix for this I would be very grateful...
Many thanks in advance...
Take a look at these two links. This first might be your issue and while the fix was included on August 2012 CU you still have to make a manual edit (not a true fix in my book)
http://support.microsoft.com/kb/2598273
http://support.microsoft.com/kb/2687375
Recently, we came across a severe problem in production farm with the Content Types. I would like to explain the background of this problem first.
We have nice working feature for Content Types installation in production and test farms. We developed and deployed (using wsps) this SharePoint feature in Visual studio. We are using the publishing pages using page layouts and Content Types to help content editors to quickly publish the web pages. Unfortunately, some Content Types and site columns have been manually updated/added by some people in the production, so whenever I (developer) make some changes to the existing Content Types (using Visual Studio and feature activation/deactivation) , SharePoint removes one or two columns (during feature activation/deactivation) from Content Types; or the columns which have not been added in a best practice way. I think the best practice is to update Content Types using Visual Studio.
Now, I wish to ensure that site columns shouldn't get removed from Content Types upon feature activation/deactivation.
Note: Our feature for Content Type activation/deactivation doesn't hold any activation dependencies in the feature.xml
Recommended Approach
Based on all these factors, my suggestion would be to:
• Create two Features: one for the original markup and one for making changes. (Or you can put them in the same Feature; I just want to differentiate between where you do what.)
• The original Feature should contain the CAML for Site Columns and Content Types. This ensures the IDs have been assigned ahead of type and remain constant.
• If you want to update a Site Column by changing nearly anything about it except its Field type, do it using a Feature Receiver. By doing this, you can call the Update method and pass in a boolean indicating if you want all the existing assets in the site that inherit from this to update to, (something you couldn't do via the CAML.)
• You can also add an existing Site Column (that you provisioned via the CAML feature) to an existing Content Type (that was provisioned via the CAML feature). This is helpful if the Column was not part of that Content Type before, etc.
• In a scenario like the one I just mentioned in the last bullet point, it's necessary to deactivate and reactive the CAML feature (to provision the new assets) before calling your Feature Receiver. What will this mean for the site? Since all the Site Columns and Content Types in the lists in the site are using the same ID's as the ones provisioned in the Site Collection root, removing its parent from the Site Collection won't change that. It might leave it orphaned temporarily, (i.e. there will be no relationship between that item and an item in the Site Collection root, but it will function the same way it always has, since it's really a fully-functioning copy of the original item) until you reactivate the Feature that puts the item back in the Site Collection. It's like the parents are going on vacation when you deactivate the Feature, and are coming back home when you activate the Feature again.
You have a choice when it comes to how you maintain the CAML and the Feature Receiver, since you have two scenarios: existing Site Collections and new ones.
• You could make a policy that every time you write code in your Feature Receiver to update a Site Column or Content Type, you have to make the change in your CAML as well. That would mean that every time you activated the CAML Feature in a "fresh" Site Collection, the CAML would be up-to-date and accurate; there would be no need to run the "updater" feature. (In your Feature Receiver, you should make sure you do some extra checking to make sure a Site Column doesn't already belong to a Content Type before adding it, etc. in case that change is already in place before the code executes.) This approach means you only have to execute one Feature when creating a new Site Collection, but it also means you're maintaining changes in two places: in your Feature Receiver for making changes to existing sites, and in your CAML for new sites. It's a cleaner approach, but also contains an element of redundancy, which always leaves room for human error.
• The other approach is to simply assume that every time the base CAML feature is activated, you're always going to execute the Feature Receiver. This approach says the only time you'd change the CAML is to add a new Site Column or new Content Type; otherwise, all the changes happen in the Feature Receiver. This approach reduces redundancy, but also means your Feature Receiver code could get quite large with all your changes over time, and it could leave your CAML as very much "legacy" over time.
Src: http://blog.beckybertram.com/Lists/Posts/Post.aspx?List=eb3e1762%2Dbab0%2D4e96%2D8bc5%2Dd67d6e6bfd44&ID=18
Updating Content Types is still one of the underdeveloped portions of Sharepoint which sometimes causes trouble, especially in Content Deployment scenarios.
The best thing in your case would be to always avoid making any changes to content types by hand (using UI)
Whenever you are installing the content type, make sure that you remove the previous one and then install the new one. (Sometimes its not possible due to pages being already created out of it).
My current approach to deploying content types is to do as much as possible using code rather than CAML. That way it is easy to fully control the logic of updates, including ensuring that changes made manually don't cause conflicts. I have the structure defined as attributes on an interface I also use for strongly typed list access, but there are several other ways you could do it.
The only piece that isn't available in the API is setting a specific content type ID, so you need to have a caml file for that, but it's a small/simple file, doesn't try to make updates and is only referenced from a feature that will also run the update code.