4

In a doc library, the Title column is blank but the Name column contains the filename of the document uploaded. I want to concatenate (?) the Title column to auto fill-in what the Name column contains. Is there a simple calculated formula to use? My point in doing this is to create a lookup column from a List to include the name(s) of the documents in a Doc Library, yet the only seemingly relevant columns I can "lookup" are the Title column, which is not blank in that Doc Lib list.

Thanks for any assistance!

1

Use the suggested Workflow method to rename new added items

For existing items, Open a Document Library,
run this script from a (Chrome) F12 Dev Tools Snippet,
or as a Bookmarklet in any browser

var ctx = new SP.ClientContext.get_current();
var listGuid = SP.ListOperation.Selection.getSelectedList();
var list = ctx.get_web().get_lists().getById(listGuid);
var query = SP.CamlQuery.createAllItemsQuery();
var items = list.getItems(query);
ctx.load(items);
ctx.executeQueryAsync(processItems);

function processItems(sender, args) {
    var listEnumerator = items.getEnumerator();
    while (listEnumerator.moveNext()) {
        var item = listEnumerator.get_current();
        var id = item.get_id();
        var title = item.get_item('Title');
        var fileName = item.get_item('FileLeafRef');
            console && console.log('Renaming Title to:', fileName);
            item.set_item('Title', fileName);
            item.update();
            ctx.executeQueryAsync();
    }
}

iJSOM

4

As per document library field Title column is Single line of text. so you are not able to change the type of Title column to Calculated column.

So There is one option, you can auto populate Name field value in Title.

you can use declarative workflow.

enter image description here

you can use Set Filed in current item action

0

First, you'd need to make the Title column optional, which would require creating a content type. You could then create a SharePoint Designer workflow that would populate the Title with the contents of Name whenever the item is edited.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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