Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

By default every custom list has a Created By field.... What I need is another one to display the users Mobile Number data as well. That way i can display their name and number on new list items automatically.

Is this possible?

share|improve this question

3 Answers 3

Create a new column of person/group variety. Have it set to display the users mobile number. Create a simmple on creation workflow that copies the Created BY field into the newly created column.

share|improve this answer

You can add at any time your own field (data type could be any of the available types -e.g Single line of text) however not automatically maintained, basically you simply go to List/Library settings and create a new field.

If you have enabled Management of Content Types, you would have to add it there.

In addition, if you plan to reuse it across different lists you would need to create your own Content Type, based on the one which you try to extend and add that particular content type to all lists/libraries where you need the same behaviour.

To show it, simply update the View to include it.

share|improve this answer

You can add another number field and then use a Item Added event to populate its value. There might be better solution but I tried this one before.

    class myClass : SPItemEventReceiver
    {
        public override void ItemAdded(SPItemEventProperties properties)
        {
            try
            {
                this.DisableEventFiring();

                PopulatePhoneNumberField(properties);
            }
            catch (Exception ex)
            {
                //log here
            }
            finally
            {
                this.EnableEventFiring();
            }
        }

  private void PopulatePhoneNumberField(SPItemEventProperties properties)
        {

            SPList currentList = properties.List;
            string CreatedByValue = properties.ListItem.Properties["YourFieldName"];
            // or maybe you can use SPUser here and get user straight away 
            // I don't have my VPC with me otherwise I would check it for you,
   }
  } 
 } 

Once you got the user, you can access its AD properties by adding some extra code, I am pretty sure simple googling will help you finding code.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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