1

How to set Currency Format like ₹ 123,456.00(India). We can set it by using the Sharepoint Online. I want to know how to set it by using CSOM. Is there any enum Type to set CurrencyLocaleId. Thank You.

using (ClientContext context = new ClientContext("https://rohith.sharepoint.com/sites/site"))
        {
            context.Credentials = new SharePointOnlineCredentials(username, password);
            ListCreationInformation listinfo = new ListCreationInformation();
            List list = context.Web.Lists.GetByTitle("Custom List");
            context.Load(list);

            FieldCurrency fieldCurrency = context.CastTo<FieldCurrency>(list.AddField("Price", "Currency"));
            //Here how to set Currency Format
            fieldCurrency.CurrencyLocaleId = 1081;

            fieldCurrency.Update();
            ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();

            ListItem listItem = list.AddItem(itemCreateInfo);
            listItem["Title"] = "Books";
            listItem["Quentity"] = 12;
            listItem["Price"] = 100;

            listItem.Update();
            context.ExecuteQuery();
        }
1
  • Please, don't ask the same question again, you can edit your original post instead of deleting it! Commented Jul 14, 2017 at 12:03

1 Answer 1

0

Please try the below code snippet instead of the FieldCurrency approach that you are taking right now. Please modify the xmlField as per your requirement. Let me know if you have any questions.

string xmlField = "<Field ID=\"{ 1706A5C3 - AC44 - 4685 - A075 - 6019FAF9D940}\" Name=\"Budget\" DisplayName = \"Volumen (in €)\" Type = \"Currency\" LCID = \"1033\" />";

list.Fields.AddFieldAsXml(xmlField, true, ddFieldOptions.AddFieldToDefaultView);

Source - How to configure Currency Field

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.