5

I am creating a webpart using SPFX. I want to store properties set by a different user.

For EX:

  • I am going to create weather webpart. So, User1 has set Paris and User2 has set London.

  • When user1 Log in Webpart display temperature of Paris and for user2 it displays temperature of London.

What is the best way to store properties with per user personalized scope using SPFX?

4
  • Why not in a cookie? If you needed more permanent/complicated persistence you could use a list but that does not seem to be required in your case.
    – Bunzab
    Jun 28, 2017 at 12:58
  • @Bunzab can we use property bag or sharepoint file system for that? Jun 28, 2017 at 13:18
  • Using the property bag for user values is not a good idea. A list could be interpreted as the SP "file system". You didn't answer my question though. Why not use a cookie?
    – Bunzab
    Jun 28, 2017 at 13:34
  • @Bunzab i want to store large amount of data as well as we have to persist data even if user clear browser cache. hey can please give me a hint how can i use property bag? Jun 28, 2017 at 14:47

2 Answers 2

2

Ideally you should use a SharePoint list to store the information that you need. You can create a custom list with all the columns that you require and then query that list to display the data that you need. There are plenty of examples on how to do this on SE.

You could use the property bag but it was designed for config strings. If you have a large amount of user data as you state, a list is what you should be using.

If you insist on using the property bag see this answer by @Rob-Windsor

0

Why do you want to store it in Properties? I prefer to use HTML Geo-location co-ordinates using JavaScript for this kind of task, which is available for all the major browsers. Have a look at w3chools document. This will simplify your task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.