Free Support Forum - aspose.com

Public folder creation in in office 365 through ews client

hello,
i m trying to create public folder in the my office 365 account using createPublicFolder option but m getting classcastexception

ExchangeFolderUserInfo userInfo = ExchangeFolderUserInfo.getDefaultUser();

    		userInfo.getUserAccountType();
    		userInfo.getPrimarySmtpAddress();
    	      
    		ExchangeFolderPermissionCollection pc = new ExchangeFolderPermissionCollection();
    		ExchangeFolderPermission permission1=new ExchangeFolderPermission(userInfo);
    		permission1.canCreateItems(true);
            permission1.setDeleteItems(ExchangeFolderPermissionAction.Owned);
            permission1.setFolderVisible(true);
            permission1.setFolderOwner(true);
            permission1.setReadItems(ExchangeFolderPermissionReadAccess.FullDetails);
            pc.addItem(permission1);
            String uri =client.createPublicFolder("MY11",pc).getUri();

please urgently

@Harish2020,

Can you please share the complete stack trace with us. Please also try using latest Aspose.Email for Java 20.6 on your end as well.

here the full stack trace while using aspose email java 20.6


java.lang.ClassCastException: com.aspose.email.microsoft.schemas.exchange.services._2006.types.DistinguishedFolderIdType cannot be cast to com.aspose.email.microsoft.schemas.exchange.services._2006.types.FolderIdType
at com.aspose.email.zpy.a(SourceFile:376)
at com.aspose.email.zpp.createPublicFolder(SourceFile:6314)
at pstToNsf.pracStr.main(pracStr.java:103)

@Harish2020,

Can you please following the example given on this link and if there is still an issue then please share the account credentials with us reproducing the issue so that we may investigate it further.

okay ,
please provide the link

@Harish2020,

Apologies for missing the link. Please visit this link for your convenience.

it’s not the issue.
We have to create a public folder but from the link here we can only get the message, could you help us with it.we tried using all the overloaded method createpublicfolder but are getting this exception could you tell us if we have to give some specific permission like exchangefolderpermission

@Harish2020,

I have created an issue with ID EMAILJAVA-34724 in our issue tracking system to further investigate the issue on our end. We request for your patience and will share the feedback with you as soon as the issue will be fixed.