sharepoint - Find a specific field on a site and the set it to “Required” in a EventReciever -


I have created an event receiver that creates a site when it is activated. There is an announcement webpage on this site when they click on "ad declaration", newform.aspx pops up as a dialogue and there is an area called timeless, the need to make it necessary , So the field other should be used and it prevents the user from adding an announcement

how can I find that specific field and set it to be necessary in my event I can answer?

  & lt ;! - FieldName = "Finish" FieldInternalName = "Expired" FieldType = "SPFieldDateTime" - & gt;   

This way I have made progress so far:

  Public override zero feature disabled (SPFeatureReceiverProperties properties) {if (properties.Feature.Parent is SPWeb) {Var web = Properties Fiction. Mother in the form of SP vaib; Var expiredDate = web.Fields.GetFieldByInternalName ("Finished"); ExpiredDate.Required = true; ExpiredDate.Update (); }}   

Any kind of tips or help is appreciated!

Is your webpart likely to query a specific list? In that situation, there is also an option to eliminate the required deadline in that list.

Your current code will only update the site column ending in the site, these changes will be made to this column. If you were preparing a new list after executing your code, then you will have a list that requires expiration.

While reading your code, I guess you actually want to update the current list and all the new lists in that case with the expiredDate.Update () expiredDate.Update (true) should be modified. This is an indication for Boolean SharePoint that you want to push the changes into existing lists. After performing this update, you will see that users are required to expire in your existing lists.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -