Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
3,817 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello there,
I have written some code for my project, where I'm creating the worksheet using the Graph API version 5.42 in Java.
Now I'm updating the version to the latest one, and it is not showing the below error for the respective code.
Error showing in the below code:
Cannot resolve method 'me()'
Cannot resolve symbol 'WorkbookWorksheetAddParameterSet'
Cannot resolve symbol 'GraphServiceException'
Code:
import com.microsoft.graph.http.GraphServiceException;
import com.microsoft.graph.models.*;
import com.microsoft.graph.options.HeaderOption;
import com.microsoft.graph.requests.GraphServiceClient;
import com.microsoft.graph.requests.WorkbookWorksheetRangeRequest;
private GraphServiceClient client;
public boolean createWorksheet(String worksheetName) {
try {
// API call to create new worksheet
client.me()
.drive()
.root()
.itemWithPath(workbookPath)
.workbook()
.worksheets()
.add(
WorkbookWorksheetAddParameterSet.newBuilder()
.withName(Utils.encodeString(worksheetName))
.build())
.buildRequest(workbookSessionIdHeader)
.post();
setActiveSheetName(worksheetName);
return true;
} catch (GraphServiceException exception) {
System.err.println("Graph service encountered an error: " + exception.getMessage());
}
}
This code worked perfectly fine with the older API version, but it's breaking with the newer API version.