Ders davetlerini yönetme
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Classroom'daki Invitation kaynağı, kullanıcıların belirli bir kurs rolü (öğrenci, öğretmen veya sahip) ile kursa katılma davetini temsil eder.
Her Invitation kaynağı aşağıdaki alanları içerir:
id: Davetiye için Classroom tarafından atanan tanımlayıcı.
userId: Kursa davet edilen kullanıcının kimliği.
courseId: Kullanıcının davet edildiği kurs.
role: Davet edilen kullanıcının kursta sahip olacağı kurs rolü.
Davetiye oluşturma
invitations.create() yöntemi, belirli bir role sahip bir kullanıcıyı kursa davet etmek için kullanılabilir. İstek gövdesine Invitation kaynağını ekleyin
ve courseId, userId ve role değerlerini belirtin.
Invitationinvitation=null;try{/* Set the role the user is invited to have in the course. Possible values of CourseRole can be found here: https://developers.google.com/classroom/reference/rest/v1/invitations#courserole.*/Invitationcontent=newInvitation().setCourseId(courseId).setUserId(userId).setRole("TEACHER");invitation=service.invitations().create(content).execute();System.out.printf("User (%s) has been invited to course (%s).\n",invitation.getUserId(),invitation.getCourseId());}catch(GoogleJsonResponseExceptione){// TODO (developer) - handle error appropriatelyGoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The course or user does not exist.\n");}throwe;}catch(Exceptione){throwe;}returninvitation;
Davetiyeyi alma
invitations.get() yöntemini çağırıp davetin id değerini belirterek belirli bir daveti alın.
Invitationinvitation=null;try{invitation=service.invitations().get(id).execute();System.out.printf("Invitation (%s) for user (%s) in course (%s) retrieved.\n",invitation.getId(),invitation.getUserId(),invitation.getCourseId());}catch(GoogleJsonResponseExceptione){GoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The invitation id (%s) does not exist.\n",id);}throwe;}catch(Exceptione){throwe;}returninvitation;
try{service.invitations().accept(id).execute();System.out.printf("Invitation (%s) was accepted.\n",id);}catch(GoogleJsonResponseExceptione){GoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The invitation id (%s) does not exist.\n",id);}throwe;}catch(Exceptione){throwe;}
Davetiyeyi silme
Davetiyeyi güncellemenin tek yolu, davetiyeyi silip yeni bir davetiye oluşturmaktır. Daveti silmek için invitations.delete() yöntemini çağırın
ve id değerini belirtin.
try{service.invitations().delete(id).execute();System.out.printf("Invitation (%s) was deleted.\n",id);}catch(GoogleJsonResponseExceptione){GoogleJsonErrorerror=e.getDetails();if(error.getCode()==404){System.out.printf("The invitation id (%s) does not exist.\n",id);}throwe;}catch(Exceptione){throwe;}
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-01 UTC."],[],[]]